Project

General

Profile

« Previous | Next » 

Revision 396346a2

Added by Cherian Mathew over 9 years ago

added possibility to show / hide uuid column
added scrolling to the viewer

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/group/grantedauthority/CdmAuthorityTableHeader.java
1 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
*/
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 9
package eu.etaxonomy.taxeditor.ui.group.grantedauthority;
10 10

  
11 11
import org.eclipse.swt.SWT;
......
15 15
import org.eclipse.swt.layout.GridData;
16 16
import org.eclipse.swt.layout.GridLayout;
17 17
import org.eclipse.swt.widgets.Composite;
18
import org.eclipse.swt.widgets.Control;
18 19
import org.eclipse.swt.widgets.Display;
19 20
import org.eclipse.swt.widgets.Label;
20 21
import org.eclipse.ui.forms.widgets.FormToolkit;
22
import org.eclipse.wb.swt.SWTResourceManager;
21 23

  
22 24
/**
23 25
 * Table header widget for {@link CdmAuthorityComposite}
......
29 31
public class CdmAuthorityTableHeader extends Composite {
30 32

  
31 33
	private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
32

  
34
	private CLabel lblUuid;
35
	private CLabel lblOperation;
33 36
	/**
34 37
	 * Create the composite, with 5 header fields.
35 38
	 * 
......
45 48
		});
46 49
		toolkit.adapt(this);
47 50
		toolkit.paintBordersFor(this);
48
		setLayout(new GridLayout(4, false));
49
		
51
		setLayout(new GridLayout(5, false));
52

  
50 53
		Label lblDirtyFlag = new Label(this, SWT.NONE);
51 54
		GridData gd_lblDirtyFlag = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
52 55
		gd_lblDirtyFlag.widthHint = 15;
53 56
		lblDirtyFlag.setLayoutData(gd_lblDirtyFlag);
54
		
57

  
55 58
		toolkit.adapt(lblDirtyFlag, true, true);
56 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

  
57 70
		CLabel lblEntity = new CLabel(this, SWT.NONE);
58 71
		lblEntity.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
59 72
		lblEntity.setAlignment(SWT.CENTER);
......
63 76
		toolkit.adapt(lblEntity);
64 77
		toolkit.paintBordersFor(lblEntity);
65 78
		lblEntity.setText("ENTITY");
79

  
80
		//createUUIDHeader();
66 81
		
67
		CLabel lblUuid = new CLabel(this, SWT.NONE);
68
		lblUuid.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
69
		lblUuid.setAlignment(SWT.CENTER);
70
		GridData gd_lblUuid = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
71
		gd_lblUuid.widthHint = 270;
72
		lblUuid.setLayoutData(gd_lblUuid);
73
		toolkit.adapt(lblUuid);
74
		toolkit.paintBordersFor(lblUuid);
75
		lblUuid.setText("UUID");
76
		
77
		CLabel lblOperation = new CLabel(this, SWT.NONE);
82
		lblOperation = new CLabel(this, SWT.NONE);
78 83
		lblOperation.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
79 84
		lblOperation.setAlignment(SWT.CENTER);
80 85
		GridData gd_lblOperation = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
......
86 91

  
87 92
	}
88 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

  
89 122
}

Also available in: Unified diff