View Javadoc
1   package org.argeo.eclipse.ui;
2   
3   import org.eclipse.jface.viewers.ColumnLabelProvider;
4   
5   /**
6    * Wraps the definition of a column to be used in the various JFace viewers
7    * (typically tree and table). It enables definition of generic viewers which
8    * column can be then defined externally. Also used to generate export.
9    */
10  public class ColumnDefinition {
11  	private ColumnLabelProvider labelProvider;
12  	private String label;
13  	private int weight = 0;
14  	private int minWidth = 120;
15  
16  	public ColumnDefinition(ColumnLabelProvider labelProvider, String label) {
17  		this.labelProvider = labelProvider;
18  		this.label = label;
19  	}
20  
21  	public ColumnDefinition(ColumnLabelProvider labelProvider, String label,
22  			int weight) {
23  		this.labelProvider = labelProvider;
24  		this.label = label;
25  		this.weight = weight;
26  		this.minWidth = weight;
27  	}
28  
29  	public ColumnDefinition(ColumnLabelProvider labelProvider, String label,
30  			int weight, int minimumWidth) {
31  		this.labelProvider = labelProvider;
32  		this.label = label;
33  		this.weight = weight;
34  		this.minWidth = minimumWidth;
35  	}
36  
37  	public ColumnLabelProvider getLabelProvider() {
38  		return labelProvider;
39  	}
40  
41  	public void setLabelProvider(ColumnLabelProvider labelProvider) {
42  		this.labelProvider = labelProvider;
43  	}
44  
45  	public String getLabel() {
46  		return label;
47  	}
48  
49  	public void setLabel(String label) {
50  		this.label = label;
51  	}
52  
53  	public int getWeight() {
54  		return weight;
55  	}
56  
57  	public void setWeight(int weight) {
58  		this.weight = weight;
59  	}
60  
61  	public int getMinWidth() {
62  		return minWidth;
63  	}
64  
65  	public void setMinWidth(int minWidth) {
66  		this.minWidth = minWidth;
67  	}
68  }