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/CdmAuthorityRow.java
38 38

  
39 39
	private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
40 40
	private Label lblEntity;
41
	private Label lblTarget;
41
	private Label lblUuid;
42 42
	private CRUDOperationChooser operationChooser;
43 43
	private Button btnDelete;
44 44
	
......
46 46
	private Label lblDirtyFlag;
47 47
	
48 48
	private CdmAuthorityCompositeViewer cdmaModel;
49
	private Label lblType;
49 50
	
50 51
	/**
51 52
	 * Create the composite, made up of 5 elements :
......
67 68
		});
68 69
		toolkit.adapt(this);
69 70
		toolkit.paintBordersFor(this);
70
		setLayout(new GridLayout(5, false));
71
		setLayout(new GridLayout(6, false));
71 72
		
72 73

  
73 74
		
......
79 80
		toolkit.adapt(lblDirtyFlag, true, true);
80 81
		lblDirtyFlag.setText("*");
81 82
		
82
		lblEntity = new Label(this, SWT.BORDER);
83
		lblType = new Label(this, SWT.BORDER);
84
		GridData gd_lblType = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
85
		gd_lblType.heightHint = 30;
86
		gd_lblType.widthHint = 200;
87
		lblType.setLayoutData(gd_lblType);
88
		lblType.setText("Type");
89
		lblType.setAlignment(SWT.CENTER);
90
		toolkit.adapt(lblType, true, true);
91
		
92
		lblEntity = new Label(this, SWT.BORDER | SWT.WRAP | SWT.CENTER);
83 93
		GridData gd_lblEntity = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
84 94
		gd_lblEntity.heightHint = 30;
85 95
		gd_lblEntity.widthHint = 200;
......
88 98
		toolkit.adapt(lblEntity, true, true);
89 99
		lblEntity.setText("Entity");
90 100
		
91
		lblTarget = new Label(this, SWT.BORDER + SWT.WRAP);
92
		GridData gd_lblTarget = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
93
		gd_lblTarget.heightHint = 30;
94
		gd_lblTarget.widthHint = 270;
95
		lblTarget.setLayoutData(gd_lblTarget);
96
		lblTarget.setAlignment(SWT.LEFT);
97
		toolkit.adapt(lblTarget, true, true);
98
		lblTarget.setText("Uuid");
99 101
		
100 102
		operationChooser = new CRUDOperationChooser(this, SWT.BORDER);
101 103
		operationChooser.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
......
139 141
	 * @param grantedAuthorityI
140 142
	 * @param isDirty
141 143
	 */
142
	public void setRowCdmAuthority(CdmAuthorityCompositeViewer cdmaModel, GrantedAuthorityImpl grantedAuthorityI, boolean isDirty) {
144
	public void setRowCdmAuthority(CdmAuthorityCompositeViewer cdmaModel, GrantedAuthorityImpl grantedAuthorityI, boolean isDirty, boolean showUuid) {
143 145
		this.grantedAuthorityI = grantedAuthorityI;		
144 146
		this.cdmaModel = cdmaModel;
145 147
		
......
149 151
			setDirty(isDirty);
150 152

  
151 153
			String entityStr = (cdmAuthority.getPermissionClass() == null)?"":cdmAuthority.getPermissionClass().toString();
152
			lblEntity.setText(entityStr);
154
			lblType.setText(entityStr);
153 155
			String targetLabelText = GrantedAuthorityLabelTextProvider.getTargetText(cdmAuthority);
154
			lblTarget.setText(targetLabelText);
155

  
156
			lblEntity.setText(targetLabelText);
157
						
158
			setUuidCellVisible(showUuid);
159
			if(lblUuid != null) {
160
				String targetUuid = cdmAuthority.getTargetUUID().toString();
161
				lblUuid.setText(targetUuid);
162
			}
163
			
156 164
			operationChooser.setAuthority(cdmaModel, grantedAuthorityI, cdmAuthority);				
157 165
			
158 166
		} catch (Exception e) {
......
161 169
		}
162 170

  
163 171
	}
172
	
173
	public void setUuidCellVisible(boolean visible) {
174
		if(visible) {
175
			if(lblUuid == null) {
176
				createUuidCell();
177
			}
178
			lblUuid.moveAbove(operationChooser);
179
			
180
		} else {
181
			if(lblUuid != null) {
182
				lblUuid.dispose();
183
			}
184
			lblUuid = null;
185
		}
186
		layout();
187
	}
188
	
189
	private void createUuidCell() {
190
		lblUuid = new Label(this, SWT.BORDER | SWT.CENTER);
191
		GridData gd_lblUuid = new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1);
192
		gd_lblUuid.heightHint = 30;
193
		gd_lblUuid.widthHint = 270;
194
		lblUuid.setLayoutData(gd_lblUuid);
195
		toolkit.adapt(lblUuid, true, true);
196
		lblUuid.setText("Uuid");
197
	}
164 198

  
165 199
}

Also available in: Unified diff