1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.ui.group.grantedauthority;
|
10
|
|
11
|
import org.eclipse.swt.SWT;
|
12
|
import org.eclipse.swt.custom.CLabel;
|
13
|
import org.eclipse.swt.events.DisposeEvent;
|
14
|
import org.eclipse.swt.events.DisposeListener;
|
15
|
import org.eclipse.swt.layout.GridData;
|
16
|
import org.eclipse.swt.layout.GridLayout;
|
17
|
import org.eclipse.swt.widgets.Composite;
|
18
|
import org.eclipse.swt.widgets.Control;
|
19
|
import org.eclipse.swt.widgets.Display;
|
20
|
import org.eclipse.swt.widgets.Label;
|
21
|
import org.eclipse.ui.forms.widgets.FormToolkit;
|
22
|
import org.eclipse.wb.swt.SWTResourceManager;
|
23
|
|
24
|
/**
|
25
|
* Table header widget for {@link CdmAuthorityComposite}
|
26
|
*
|
27
|
* @author cmathew
|
28
|
* @created Mar 28, 2013
|
29
|
*
|
30
|
*/
|
31
|
public class CdmAuthorityTableHeader extends Composite {
|
32
|
|
33
|
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
|
34
|
private CLabel lblUuid;
|
35
|
private CLabel lblOperation;
|
36
|
/**
|
37
|
* Create the composite, with 5 header fields.
|
38
|
*
|
39
|
* @param parent
|
40
|
* @param style
|
41
|
*/
|
42
|
public CdmAuthorityTableHeader(Composite parent, int style) {
|
43
|
super(parent, SWT.NONE);
|
44
|
addDisposeListener(new DisposeListener() {
|
45
|
public void widgetDisposed(DisposeEvent e) {
|
46
|
toolkit.dispose();
|
47
|
}
|
48
|
});
|
49
|
toolkit.adapt(this);
|
50
|
toolkit.paintBordersFor(this);
|
51
|
setLayout(new GridLayout(5, false));
|
52
|
|
53
|
Label lblDirtyFlag = new Label(this, SWT.NONE);
|
54
|
GridData gd_lblDirtyFlag = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
55
|
gd_lblDirtyFlag.widthHint = 15;
|
56
|
lblDirtyFlag.setLayoutData(gd_lblDirtyFlag);
|
57
|
|
58
|
toolkit.adapt(lblDirtyFlag, true, true);
|
59
|
|
60
|
CLabel lblType = new CLabel(this, SWT.NONE);
|
61
|
GridData gd_lblType = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
62
|
gd_lblType.widthHint = 200;
|
63
|
lblType.setLayoutData(gd_lblType);
|
64
|
lblType.setText("TYPE");
|
65
|
lblType.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLUE));
|
66
|
lblType.setAlignment(SWT.CENTER);
|
67
|
toolkit.adapt(lblType);
|
68
|
toolkit.paintBordersFor(lblType);
|
69
|
|
70
|
CLabel lblEntity = new CLabel(this, SWT.NONE);
|
71
|
lblEntity.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
|
72
|
lblEntity.setAlignment(SWT.CENTER);
|
73
|
GridData gd_lblEntity = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
|
74
|
gd_lblEntity.widthHint = 200;
|
75
|
lblEntity.setLayoutData(gd_lblEntity);
|
76
|
toolkit.adapt(lblEntity);
|
77
|
toolkit.paintBordersFor(lblEntity);
|
78
|
lblEntity.setText("ENTITY");
|
79
|
|
80
|
//createUUIDHeader();
|
81
|
|
82
|
lblOperation = new CLabel(this, SWT.NONE);
|
83
|
lblOperation.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
|
84
|
lblOperation.setAlignment(SWT.CENTER);
|
85
|
GridData gd_lblOperation = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
|
86
|
gd_lblOperation.widthHint = 150;
|
87
|
lblOperation.setLayoutData(gd_lblOperation);
|
88
|
toolkit.adapt(lblOperation);
|
89
|
toolkit.paintBordersFor(lblOperation);
|
90
|
lblOperation.setText("OPERATION");
|
91
|
|
92
|
}
|
93
|
|
94
|
|
95
|
public void setUuidHeaderVisible(boolean visible) {
|
96
|
if(visible) {
|
97
|
if(lblUuid == null) {
|
98
|
createUUIDHeader();
|
99
|
}
|
100
|
lblUuid.moveAbove(lblOperation);
|
101
|
} else {
|
102
|
if(lblUuid != null) {
|
103
|
lblUuid.dispose();
|
104
|
}
|
105
|
lblUuid = null;
|
106
|
}
|
107
|
layout();
|
108
|
}
|
109
|
|
110
|
private void createUUIDHeader() {
|
111
|
lblUuid = new CLabel(this, SWT.NONE);
|
112
|
lblUuid.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLUE));
|
113
|
lblUuid.setAlignment(SWT.CENTER);
|
114
|
GridData gd_lblUuid = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
|
115
|
gd_lblUuid.widthHint = 270;
|
116
|
lblUuid.setLayoutData(gd_lblUuid);
|
117
|
toolkit.adapt(lblUuid);
|
118
|
toolkit.paintBordersFor(lblUuid);
|
119
|
lblUuid.setText("UUID");
|
120
|
}
|
121
|
|
122
|
}
|