Project

General

Profile

« Previous | Next » 

Revision c41ac60d

Added by Andreas Müller almost 4 years ago

adapt TaxEditor to new package structure for persistence.permission and format.description and some cleanup

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/group/grantedauthority/CRUDOperationChooser.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
17 17
import org.eclipse.swt.widgets.Composite;
18 18
import org.eclipse.swt.widgets.Display;
19 19

  
20
import eu.etaxonomy.cdm.model.permission.GrantedAuthorityImpl;
21 20
import eu.etaxonomy.cdm.model.permission.CRUD;
22
import eu.etaxonomy.cdm.persistence.hibernate.permission.CdmAuthority;
23
import eu.etaxonomy.cdm.persistence.hibernate.permission.Operation;
24

  
21
import eu.etaxonomy.cdm.model.permission.GrantedAuthorityImpl;
22
import eu.etaxonomy.cdm.persistence.permission.CdmAuthority;
23
import eu.etaxonomy.cdm.persistence.permission.Operation;
25 24

  
26 25
/**
27 26
 * Widget for editing {@link Operation} objects, consisting of 4 checkboxes for CREATE, UPDATE, READ, DELETE operations.
28
 * 
27
 *
29 28
 * @author cmathew
30 29
 * @created Mar 28, 2013
31
 *
32 30
 */
33 31
public class CRUDOperationChooser extends Composite {
34
	
32

  
35 33
	private Button createCheckButton;
36 34
	private Button readCheckButton;
37 35
	private Button deleteCheckButton;
38 36
	private Button updateCheckButton;
39
	
37

  
40 38
	private CdmAuthorityRow caRow;
41 39
	private GrantedAuthorityImpl grantedAuthorityI;
42 40
	private CdmAuthority cdmAuthority;
43 41
	private CdmAuthorityCompositeViewer viewer;
44
	
42

  
45 43
	/**
46 44
	 * Create the composite.
47 45
	 * @param parent
......
53 51
		RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
54 52
		rowLayout.justify = true;
55 53
		setLayout(rowLayout);
56
		
57
		
54

  
58 55
		this.caRow = parent;
59 56
		createCheckButton = new Button(this, SWT.CHECK);
60 57
		createCheckButton.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
......
71 68
						grantedAuthorityI = viewer.updateGrantedAuthority(grantedAuthorityI, cdmAuthority);
72 69
						parent.setDirty(true);
73 70
					}
74
					
71

  
75 72
				}
76 73
			}
77 74
		});
78 75
		createCheckButton.setText("C");
79
		
76

  
80 77
		readCheckButton = new Button(this, SWT.CHECK);
81 78
		readCheckButton.setEnabled(false);
82 79
		readCheckButton.addMouseTrackListener(new MouseTrackAdapter() {
......
97 94
						grantedAuthorityI = viewer.updateGrantedAuthority(grantedAuthorityI, cdmAuthority);
98 95
						parent.setDirty(true);
99 96
					}
100
					
97

  
101 98
				}
102
					
99

  
103 100
			}
104 101
		});
105 102
		readCheckButton.setText("R");
106
		
103

  
107 104
		deleteCheckButton = new Button(this, SWT.CHECK);
108 105
		deleteCheckButton.addMouseListener(new MouseAdapter() {
109 106
			@Override
......
118 115
						grantedAuthorityI = viewer.updateGrantedAuthority(grantedAuthorityI, cdmAuthority);
119 116
						parent.setDirty(true);
120 117
					}
121
					
118

  
122 119
				}
123 120
			}
124 121
		});
125 122
		deleteCheckButton.setText("D");
126
		
123

  
127 124
		updateCheckButton = new Button(this, SWT.CHECK);
128 125
		updateCheckButton.addMouseListener(new MouseAdapter() {
129 126
			@Override
......
138 135
						grantedAuthorityI = viewer.updateGrantedAuthority(grantedAuthorityI, cdmAuthority);
139 136
						parent.setDirty(true);
140 137
					}
141
					
138

  
142 139
				}
143 140
			}
144 141
		});
......
146 143
		updateView();
147 144
	}
148 145

  
149
	
146

  
150 147
	@Override
151 148
	protected void checkSubclass() {
152 149
		// Disable the check that prevents subclassing of SWT components
153 150
	}
154
	
151

  
155 152
	/**
156 153
	 * Set viewer, CDM Authority and corresponding GrantedAuthorityImpl object
157
	 * 
154
	 *
158 155
	 * @param viewer
159 156
	 * @param grantedAuthorityI
160 157
	 * @param cdmAuthority
161 158
	 */
162
	public void setAuthority(CdmAuthorityCompositeViewer viewer, 
159
	public void setAuthority(CdmAuthorityCompositeViewer viewer,
163 160
			GrantedAuthorityImpl grantedAuthorityI,
164 161
			CdmAuthority cdmAuthority) {
165 162
		this.grantedAuthorityI = grantedAuthorityI;
......
167 164
		this.viewer = viewer;
168 165
		updateView();
169 166
	}
170
	
171 167

  
172
	
168

  
169

  
173 170
	/**
174 171
	 * Update widget state.
175 172
	 */
......
178 175
		readCheckButton.setSelection(true);
179 176
		deleteCheckButton.setSelection(false);
180 177
		updateCheckButton.setSelection(false);
181
		
182
		
178

  
179

  
183 180
		if(cdmAuthority!= null && cdmAuthority.getOperation() != null) {
184 181
			if(cdmAuthority.getOperation().contains(CRUD.CREATE)) {
185 182
				createCheckButton.setSelection(true);

Also available in: Unified diff