View Javadoc
1   package org.argeo.eclipse.ui.jcr.lists;
2   
3   import javax.jcr.Node;
4   import javax.jcr.query.Row;
5   
6   import org.argeo.eclipse.ui.ColumnDefinition;
7   
8   /**
9    * Utility object to manage column in various tables and extracts displaying
10   * data from JCR
11   */
12  public class JcrColumnDefinition extends ColumnDefinition {
13  	private final static int DEFAULT_COLUMN_SIZE = 120;
14  
15  	private String selectorName;
16  	private String propertyName;
17  	private int propertyType;
18  	private int columnSize;
19  
20  	/**
21  	 * Use this kind of columns to configure a table that displays JCR
22  	 * {@link Row}
23  	 * 
24  	 * @param selectorName
25  	 * @param propertyName
26  	 * @param propertyType
27  	 * @param headerLabel
28  	 */
29  	public JcrColumnDefinition(String selectorName, String propertyName,
30  			int propertyType, String headerLabel) {
31  		super(new SimpleJcrRowLabelProvider(selectorName, propertyName),
32  				headerLabel);
33  		this.selectorName = selectorName;
34  		this.propertyName = propertyName;
35  		this.propertyType = propertyType;
36  		this.columnSize = DEFAULT_COLUMN_SIZE;
37  	}
38  
39  	/**
40  	 * Use this kind of columns to configure a table that displays JCR
41  	 * {@link Row}
42  	 * 
43  	 * @param selectorName
44  	 * @param propertyName
45  	 * @param propertyType
46  	 * @param headerLabel
47  	 * @param columnSize
48  	 */
49  	public JcrColumnDefinition(String selectorName, String propertyName,
50  			int propertyType, String headerLabel, int columnSize) {
51  		super(new SimpleJcrRowLabelProvider(selectorName, propertyName),
52  				headerLabel, columnSize);
53  		this.selectorName = selectorName;
54  		this.propertyName = propertyName;
55  		this.propertyType = propertyType;
56  		this.columnSize = columnSize;
57  	}
58  
59  	/**
60  	 * Use this kind of columns to configure a table that displays JCR
61  	 * {@link Node}
62  	 * 
63  	 * @param propertyName
64  	 * @param propertyType
65  	 * @param headerLabel
66  	 * @param columnSize
67  	 */
68  	public JcrColumnDefinition(String propertyName, int propertyType,
69  			String headerLabel, int columnSize) {
70  		super(new SimpleJcrNodeLabelProvider(propertyName), headerLabel,
71  				columnSize);
72  		this.propertyName = propertyName;
73  		this.propertyType = propertyType;
74  		this.columnSize = columnSize;
75  	}
76  
77  	public String getSelectorName() {
78  		return selectorName;
79  	}
80  
81  	public void setSelectorName(String selectorName) {
82  		this.selectorName = selectorName;
83  	}
84  
85  	public String getPropertyName() {
86  		return propertyName;
87  	}
88  
89  	public void setPropertyName(String propertyName) {
90  		this.propertyName = propertyName;
91  	}
92  
93  	public int getPropertyType() {
94  		return propertyType;
95  	}
96  
97  	public void setPropertyType(int propertyType) {
98  		this.propertyType = propertyType;
99  	}
100 
101 	public int getColumnSize() {
102 		return columnSize;
103 	}
104 
105 	public void setColumnSize(int columnSize) {
106 		this.columnSize = columnSize;
107 	}
108 
109 	public String getHeaderLabel() {
110 		return super.getLabel();
111 	}
112 
113 	public void setHeaderLabel(String headerLabel) {
114 		super.setLabel(headerLabel);
115 	}
116 }