KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > ColumnPixelData


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
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
10  *******************************************************************************/

11 package org.eclipse.jface.viewers;
12
13 import org.eclipse.core.runtime.Assert;
14
15 /**
16  * Describes the width of a table column in pixels, and
17  * whether the column is resizable.
18  * <p>
19  * This class may be instantiated; it is not intended to be subclassed.
20  * </p>
21  */

22 public class ColumnPixelData extends ColumnLayoutData {
23
24    /**
25      * The column's width in pixels.
26      */

27     public int width;
28
29     /**
30      * Whether to allocate extra width to the column to account for
31      * trim taken by the column itself.
32      * The default is <code>false</code> for backwards compatibility, but
33      * the recommended practice is to specify <code>true</code>, and
34      * specify the desired width for the content of the column, rather
35      * than adding a fudge factor to the specified width.
36      *
37      * @since 3.1
38      */

39     public boolean addTrim = false;
40     
41     /**
42      * Creates a resizable column width of the given number of pixels.
43      *
44      * @param widthInPixels the width of column in pixels
45      */

46     public ColumnPixelData(int widthInPixels) {
47         this(widthInPixels, true, false);
48     }
49
50     /**
51      * Creates a column width of the given number of pixels.
52      *
53      * @param widthInPixels the width of column in pixels
54      * @param resizable <code>true</code> if the column is resizable,
55      * and <code>false</code> if size of the column is fixed
56      */

57     public ColumnPixelData(int widthInPixels, boolean resizable) {
58         this(widthInPixels, resizable, false);
59     }
60
61     /**
62      * Creates a column width of the given number of pixels.
63      *
64      * @param widthInPixels
65      * the width of column in pixels
66      * @param resizable
67      * <code>true</code> if the column is resizable, and
68      * <code>false</code> if size of the column is fixed
69      * @param addTrim
70      * <code>true</code> to allocate extra width to the column to
71      * account for trim taken by the column itself,
72      * <code>false</code> to use the given width exactly
73      * @since 3.1
74      */

75     public ColumnPixelData(int widthInPixels, boolean resizable, boolean addTrim) {
76         super(resizable);
77         Assert.isTrue(widthInPixels >= 0);
78         this.width = widthInPixels;
79         this.addTrim = addTrim;
80     }
81 }
82
Popular Tags