01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.viewers;
11:
12: import org.eclipse.core.runtime.Assert;
13:
14: /**
15: * Describes the width of a table column in pixels, and
16: * whether the column is resizable.
17: * <p>
18: * This class may be instantiated; it is not intended to be subclassed.
19: * </p>
20: */
21: public class ColumnPixelData extends ColumnLayoutData {
22:
23: /**
24: * The column's width in pixels.
25: */
26: public int width;
27:
28: /**
29: * Whether to allocate extra width to the column to account for
30: * trim taken by the column itself.
31: * The default is <code>false</code> for backwards compatibility, but
32: * the recommended practice is to specify <code>true</code>, and
33: * specify the desired width for the content of the column, rather
34: * than adding a fudge factor to the specified width.
35: *
36: * @since 3.1
37: */
38: public boolean addTrim = false;
39:
40: /**
41: * Creates a resizable column width of the given number of pixels.
42: *
43: * @param widthInPixels the width of column in pixels
44: */
45: public ColumnPixelData(int widthInPixels) {
46: this (widthInPixels, true, false);
47: }
48:
49: /**
50: * Creates a column width of the given number of pixels.
51: *
52: * @param widthInPixels the width of column in pixels
53: * @param resizable <code>true</code> if the column is resizable,
54: * and <code>false</code> if size of the column is fixed
55: */
56: public ColumnPixelData(int widthInPixels, boolean resizable) {
57: this (widthInPixels, resizable, false);
58: }
59:
60: /**
61: * Creates a column width of the given number of pixels.
62: *
63: * @param widthInPixels
64: * the width of column in pixels
65: * @param resizable
66: * <code>true</code> if the column is resizable, and
67: * <code>false</code> if size of the column is fixed
68: * @param addTrim
69: * <code>true</code> to allocate extra width to the column to
70: * account for trim taken by the column itself,
71: * <code>false</code> to use the given width exactly
72: * @since 3.1
73: */
74: public ColumnPixelData(int widthInPixels, boolean resizable,
75: boolean addTrim) {
76: super (resizable);
77: Assert.isTrue(widthInPixels >= 0);
78: this.width = widthInPixels;
79: this.addTrim = addTrim;
80: }
81: }
|