Mercurial > projects > dwt-addons
annotate dwtx/jface/viewers/ViewerRow.d @ 70:46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Thu, 22 May 2008 01:36:46 +0200 |
parents | ea8ff534f622 |
children | 4878bef4a38e |
rev | line source |
---|---|
10 | 1 /******************************************************************************* |
70
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
2 * Copyright (c) 2006, 2008 IBM Corporation and others. |
10 | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
70
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
10 * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
11 * - fix in bug: 166346,167325,174355,195908,198035,215069 |
10 | 12 * Port to the D programming language: |
13 * Frank Benoit <benoit@tionex.de> | |
14 *******************************************************************************/ | |
15 | |
16 module dwtx.jface.viewers.ViewerRow; | |
17 | |
18 import dwtx.jface.viewers.ViewerCell; | |
19 import dwtx.jface.viewers.ViewerRow; | |
20 import dwtx.jface.viewers.TreePath; | |
21 | |
70
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
22 import dwt.custom.StyleRange; |
10 | 23 import dwt.graphics.Color; |
24 import dwt.graphics.Font; | |
25 import dwt.graphics.Image; | |
26 import dwt.graphics.Point; | |
27 import dwt.graphics.Rectangle; | |
28 import dwt.widgets.Control; | |
29 import dwt.widgets.Widget; | |
70
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
30 import dwtx.jface.util.Policy; |
10 | 31 |
32 import dwt.dwthelper.utils; | |
33 | |
34 /** | |
35 * ViewerRow is the abstract superclass of the part that represents items in a | |
36 * Table or Tree. Implementors of {@link ColumnViewer} have to provide a | |
37 * concrete implementation for the underlying widget | |
38 * | |
39 * @since 3.3 | |
40 * | |
41 */ | |
42 public abstract class ViewerRow : Cloneable { | |
43 | |
44 /** | |
45 * Constant denoting the row above the current one (value is 1). | |
46 * | |
47 * @see #getNeighbor(int, bool) | |
48 */ | |
49 public static const int ABOVE = 1; | |
50 | |
51 /** | |
52 * Constant denoting the row below the current one (value is 2). | |
53 * | |
54 * @see #getNeighbor(int, bool) | |
55 */ | |
56 public static const int BELOW = 2; | |
70
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
57 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
58 private static final String KEY_TEXT_LAYOUT = Policy.JFACE + "styled_label_key_"; //$NON-NLS-1$ |
10 | 59 |
60 /** | |
61 * Get the bounds of the entry at the columnIndex, | |
62 * | |
63 * @param columnIndex | |
64 * @return {@link Rectangle} | |
65 */ | |
66 public abstract Rectangle getBounds(int columnIndex); | |
67 | |
68 /** | |
69 * Return the bounds for the whole item. | |
70 * | |
71 * @return {@link Rectangle} | |
72 */ | |
73 public abstract Rectangle getBounds(); | |
74 | |
75 /** | |
76 * Return the item for the receiver. | |
77 * | |
78 * @return {@link Widget} | |
79 */ | |
80 public abstract Widget getItem(); | |
81 | |
82 /** | |
83 * Return the number of columns for the receiver. | |
84 * | |
85 * @return the number of columns | |
86 */ | |
87 public abstract int getColumnCount(); | |
88 | |
89 /** | |
90 * Return the image at the columnIndex. | |
91 * | |
92 * @param columnIndex | |
93 * @return {@link Image} or <code>null</code> | |
94 */ | |
95 public abstract Image getImage(int columnIndex); | |
96 | |
97 /** | |
98 * Set the image at the columnIndex | |
99 * | |
100 * @param columnIndex | |
101 * @param image | |
102 */ | |
103 public abstract void setImage(int columnIndex, Image image); | |
104 | |
105 /** | |
106 * Get the text at the columnIndex. | |
107 * | |
108 * @param columnIndex | |
109 * @return {@link String} | |
110 */ | |
111 public abstract String getText(int columnIndex); | |
112 | |
113 /** | |
114 * Set the text at the columnIndex | |
115 * | |
116 * @param columnIndex | |
117 * @param text | |
118 */ | |
119 public abstract void setText(int columnIndex, String text); | |
120 | |
121 /** | |
122 * Get the background at the columnIndex, | |
123 * | |
124 * @param columnIndex | |
125 * @return {@link Color} or <code>null</code> | |
126 */ | |
127 public abstract Color getBackground(int columnIndex); | |
128 | |
129 /** | |
130 * Set the background at the columnIndex. | |
131 * | |
132 * @param columnIndex | |
133 * @param color | |
134 */ | |
135 public abstract void setBackground(int columnIndex, Color color); | |
136 | |
137 /** | |
138 * Get the foreground at the columnIndex. | |
139 * | |
140 * @param columnIndex | |
141 * @return {@link Color} or <code>null</code> | |
142 */ | |
143 public abstract Color getForeground(int columnIndex); | |
144 | |
145 /** | |
146 * Set the foreground at the columnIndex. | |
147 * | |
148 * @param columnIndex | |
149 * @param color | |
150 */ | |
151 public abstract void setForeground(int columnIndex, Color color); | |
152 | |
153 /** | |
154 * Get the font at the columnIndex. | |
155 * | |
156 * @param columnIndex | |
157 * @return {@link Font} or <code>null</code> | |
158 */ | |
159 public abstract Font getFont(int columnIndex); | |
160 | |
161 /** | |
162 * Set the {@link Font} at the columnIndex. | |
163 * | |
164 * @param columnIndex | |
165 * @param font | |
166 */ | |
167 public abstract void setFont(int columnIndex, Font font); | |
168 | |
169 /** | |
170 * Get the ViewerCell at point. | |
171 * | |
172 * @param point | |
173 * @return {@link ViewerCell} | |
174 */ | |
175 public ViewerCell getCell(Point point) { | |
176 int index = getColumnIndex(point); | |
177 return getCell(index); | |
178 } | |
179 | |
180 /** | |
181 * Get the columnIndex of the point. | |
182 * | |
183 * @param point | |
184 * @return int or -1 if it cannot be found. | |
185 */ | |
186 public int getColumnIndex(Point point) { | |
187 int count = getColumnCount(); | |
188 | |
189 // If there are no columns the column-index is 0 | |
190 if (count is 0) { | |
191 return 0; | |
192 } | |
193 | |
194 for (int i = 0; i < count; i++) { | |
195 if (getBounds(i).contains(point)) { | |
196 return i; | |
197 } | |
198 } | |
199 | |
200 return -1; | |
201 } | |
202 | |
203 /** | |
204 * Get a ViewerCell for the column at index. | |
205 * | |
206 * @param column | |
207 * @return {@link ViewerCell} or <code>null</code> if the index is | |
208 * negative. | |
209 */ | |
210 public ViewerCell getCell(int column) { | |
211 if (column >= 0) | |
212 return new ViewerCell(cast(ViewerRow) clone(), column, getElement()); | |
213 | |
214 return null; | |
215 } | |
216 | |
217 /** | |
218 * Get the Control for the receiver. | |
219 * | |
220 * @return {@link Control} | |
221 */ | |
222 public abstract Control getControl(); | |
223 | |
224 /** | |
225 * Returns a neighboring row, or <code>null</code> if no neighbor exists | |
226 * in the given direction. If <code>sameLevel</code> is <code>true</code>, | |
227 * only sibling rows (under the same parent) will be considered. | |
228 * | |
229 * @param direction | |
230 * the direction {@link #BELOW} or {@link #ABOVE} | |
231 * | |
232 * @param sameLevel | |
233 * if <code>true</code>, search only within sibling rows | |
234 * @return the row above/below, or <code>null</code> if not found | |
235 */ | |
236 public abstract ViewerRow getNeighbor(int direction, bool sameLevel); | |
237 | |
238 /** | |
239 * The tree path used to identify an element by the unique path | |
240 * | |
241 * @return the path | |
242 */ | |
243 public abstract TreePath getTreePath(); | |
244 | |
43
ea8ff534f622
Fix override and super aliases
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
245 public /+override+/ abstract Object clone(); |
10 | 246 |
247 /** | |
248 * @return the model element | |
249 */ | |
250 public abstract Object getElement(); | |
251 | |
43
ea8ff534f622
Fix override and super aliases
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
252 public override hash_t toHash() { |
10 | 253 final int prime = 31; |
254 int result = 1; | |
255 result = prime * result | |
256 + ((getItem() is null) ? 0 : getItem().toHash()); | |
257 return result; | |
258 } | |
259 | |
43
ea8ff534f622
Fix override and super aliases
Frank Benoit <benoit@tionex.de>
parents:
10
diff
changeset
|
260 public override int opEquals(Object obj) { |
10 | 261 if (this is obj) |
262 return true; | |
263 if (obj is null) | |
264 return false; | |
265 if (this.classinfo !is obj.classinfo) | |
266 return false; | |
267 ViewerRow other = cast(ViewerRow) obj; | |
268 if (getItem() is null) { | |
269 if (other.getItem() !is null) | |
270 return false; | |
271 } else if (!getItem().opEquals(other.getItem())) | |
272 return false; | |
273 return true; | |
274 } | |
275 | |
70
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
276 /** |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
277 * The cell at the current index (as shown in the UI). This can be different |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
278 * to the original index when columns are reordered. |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
279 * |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
280 * @param visualIndex |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
281 * the current index (as shown in the UI) |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
282 * @return the cell at the currently visible index |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
283 */ |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
284 ViewerCell getCellAtVisualIndex(int visualIndex) { |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
285 return getCell(getCreationIndex(visualIndex)); |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
286 } |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
287 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
288 /** |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
289 * Translate the original column index to the actual one. |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
290 * <p> |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
291 * <b>Because of backwards API compatibility the default implementation |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
292 * returns the original index. Implementators of {@link ColumnViewer} should |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
293 * overwrite this method if their widget supports reordered columns</b> |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
294 * </p> |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
295 * |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
296 * @param creationIndex |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
297 * the original index |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
298 * @return the current index (as shown in the UI) |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
299 * @since 3.4 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
300 */ |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
301 protected int getVisualIndex(int creationIndex) { |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
302 return creationIndex; |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
303 } |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
304 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
305 /** |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
306 * Translate the current column index (as shown in the UI) to the original |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
307 * one. |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
308 * <p> |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
309 * <b>Because of backwards API compatibility the default implementation |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
310 * returns the original index. Implementators of {@link ColumnViewer} should |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
311 * overwrite this method if their widget supports reordered columns</b> |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
312 * </p> |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
313 * |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
314 * @param visualIndex |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
315 * the current index (as shown in the UI) |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
316 * @return the original index |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
317 * @since 3.4 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
318 */ |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
319 protected int getCreationIndex(int visualIndex) { |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
320 return visualIndex; |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
321 } |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
322 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
323 /** |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
324 * The location and bounds of the area where the text is drawn depends on |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
325 * various things (image displayed, control with DWT.CHECK) |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
326 * |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
327 * @param index |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
328 * the column index |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
329 * @return the bounds of the of the text area. May return <code>null</code> |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
330 * if the underlying widget implementation doesn't provide this |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
331 * information |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
332 * @since 3.4 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
333 */ |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
334 public Rectangle getTextBounds(int index) { |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
335 return null; |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
336 } |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
337 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
338 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
339 /** |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
340 * Returns the location and bounds of the area where the image is drawn. |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
341 * |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
342 * @param index |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
343 * the column index |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
344 * @return the bounds of the of the image area. May return <code>null</code> |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
345 * if the underlying widget implementation doesn't provide this |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
346 * information |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
347 * @since 3.4 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
348 */ |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
349 public Rectangle getImageBounds(int index) { |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
350 return null; |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
351 } |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
352 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
353 /** |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
354 * Set the style ranges to be applied on the text label at the column index |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
355 * Note: Requires {@link StyledCellLabelProvider} with owner draw enabled. |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
356 * |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
357 * @param columnIndex the index of the column |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
358 * @param styleRanges the styled ranges |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
359 * |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
360 * @since 3.4 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
361 */ |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
362 public void setStyleRanges(int columnIndex, StyleRange[] styleRanges) { |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
363 getItem().setData(KEY_TEXT_LAYOUT + columnIndex, styleRanges); |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
364 } |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
365 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
366 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
367 /** |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
368 * Returns the style ranges to be applied on the text label at the column index or <code>null</code> if no |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
369 * style ranges have been set. |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
370 * |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
371 * @param columnIndex the index of the column |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
372 * @return styleRanges the styled ranges |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
373 * |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
374 * @since 3.4 |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
375 */ |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
376 public StyleRange[] getStyleRanges(int columnIndex) { |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
377 return (StyleRange[]) getItem().getData(KEY_TEXT_LAYOUT + columnIndex); |
46a6e0e6ccd4
Merge with d-fied sources of 3.4M7
Frank Benoit <benoit@tionex.de>
parents:
43
diff
changeset
|
378 } |
10 | 379 } |