2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.ui
.group
.grantedauthority
;
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
;
25 * Table header widget for {@link CdmAuthorityComposite}
28 * @created Mar 28, 2013
31 public class CdmAuthorityTableHeader
extends Composite
{
33 private final FormToolkit toolkit
= new FormToolkit(Display
.getCurrent());
34 private CLabel lblUuid
;
35 private CLabel lblOperation
;
37 * Create the composite, with 5 header fields.
42 public CdmAuthorityTableHeader(Composite parent
, int style
) {
43 super(parent
, SWT
.NONE
);
44 addDisposeListener(new DisposeListener() {
45 public void widgetDisposed(DisposeEvent e
) {
50 toolkit
.paintBordersFor(this);
51 setLayout(new GridLayout(5, false));
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
);
58 toolkit
.adapt(lblDirtyFlag
, true, true);
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
);
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");
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");
95 public void setUuidHeaderVisible(boolean visible
) {
100 lblUuid
.moveAbove(lblOperation
);
102 if(lblUuid
!= null) {
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");