Revision 56a14252
Added by Cherian Mathew about 9 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewPart.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 |
* Copyright (C) 2015 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
3 |
* Copyright (C) 2015 EDIT
|
|
4 |
* European Distributed Institute of Taxonomy
|
|
5 |
* http://www.e-taxonomy.eu
|
|
6 |
*
|
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms.
|
|
9 |
*/
|
|
10 | 10 |
package eu.etaxonomy.taxeditor.view.sessions; |
11 | 11 |
|
12 | 12 |
import java.text.DecimalFormat; |
... | ... | |
33 | 33 |
import org.eclipse.wb.swt.SWTResourceManager; |
34 | 34 |
|
35 | 35 |
import eu.etaxonomy.cdm.api.cache.CdmCacher; |
36 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
36 | 37 |
import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager; |
37 | 38 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
38 | 39 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager; |
... | ... | |
47 | 48 |
public class SessionsViewPart extends ViewPart implements ICdmEntitySessionManagerObserver { |
48 | 49 |
|
49 | 50 |
public static final String ID = "eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"; //$NON-NLS-1$ |
51 |
public static final String OPEN_INSPECT_SESSIONS_DIALOG_ID = "eu.etaxonomy.taxeditor.store.open.InspectSessionsDialog"; |
|
50 | 52 |
private Table tableSessions; |
51 | 53 |
|
52 | 54 |
private final String[] titles = { "Owner", "In Memory", "On Disk"}; |
... | ... | |
58 | 60 |
private Text txtCdmModelInMemory; |
59 | 61 |
private Text txtCdmModelOnDisk; |
60 | 62 |
private Text txtDefaultOnDisk; |
63 |
|
|
61 | 64 |
public SessionsViewPart() { |
62 | 65 |
this.cdmEntitySessionManager = CdmStore.getCurrentSessionManager(); |
63 | 66 |
if(cdmEntitySessionManager != null) { |
... | ... | |
72 | 75 |
@Override |
73 | 76 |
public void createPartControl(Composite parent) { |
74 | 77 |
Composite container = new Composite(parent, SWT.NONE); |
75 |
container.setLayout(new GridLayout(6, false));
|
|
78 |
container.setLayout(new GridLayout(5, false));
|
|
76 | 79 |
{ |
77 | 80 |
Label lblNoOfSessions = new Label(container, SWT.NONE); |
78 | 81 |
lblNoOfSessions.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
... | ... | |
94 | 97 |
new Label(container, SWT.NONE); |
95 | 98 |
new Label(container, SWT.NONE); |
96 | 99 |
new Label(container, SWT.NONE); |
97 |
new Label(container, SWT.NONE); |
|
98 | 100 |
{ |
99 | 101 |
Label lblNoOfCaches = new Label(container, SWT.CENTER); |
100 | 102 |
lblNoOfCaches.setAlignment(SWT.RIGHT); |
... | ... | |
113 | 115 |
} |
114 | 116 |
new Label(container, SWT.NONE); |
115 | 117 |
new Label(container, SWT.NONE); |
116 |
new Label(container, SWT.NONE); |
|
117 | 118 |
new Label(container, SWT.NONE); |
118 | 119 |
|
119 |
{
|
|
120 |
Label lblDefaultCache = new Label(container, SWT.CENTER);
|
|
121 |
lblDefaultCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
|
122 |
lblDefaultCache.setText("Default Cache, ");
|
|
123 |
lblDefaultCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
|
|
124 |
lblDefaultCache.setAlignment(SWT.RIGHT);
|
|
125 |
}
|
|
120 |
{ |
|
121 |
Label lblDefaultCache = new Label(container, SWT.CENTER); |
|
122 |
lblDefaultCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
|
123 |
lblDefaultCache.setText("Default Cache, "); |
|
124 |
lblDefaultCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
125 |
lblDefaultCache.setAlignment(SWT.RIGHT); |
|
126 |
} |
|
126 | 127 |
{ |
127 | 128 |
Label lblDefaultInMemory = new Label(container, SWT.CENTER); |
128 | 129 |
lblDefaultInMemory.setText("in Memory : "); |
... | ... | |
152 | 153 |
gd_txtDefaultOnDisk.widthHint = 130; |
153 | 154 |
txtDefaultOnDisk.setLayoutData(gd_txtDefaultOnDisk); |
154 | 155 |
} |
155 |
new Label(container, SWT.NONE); |
|
156 | 156 |
{ |
157 | 157 |
Label lblCdmModelCache = new Label(container, SWT.CENTER); |
158 | 158 |
lblCdmModelCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
... | ... | |
191 | 191 |
gd_txtCdmModelOnDisk.widthHint = 130; |
192 | 192 |
txtCdmModelOnDisk.setLayoutData(gd_txtCdmModelOnDisk); |
193 | 193 |
} |
194 |
new Label(container, SWT.NONE); |
|
195 | 194 |
{ |
196 | 195 |
Button btnRefresh = new Button(container, SWT.NONE); |
197 | 196 |
btnRefresh.addSelectionListener(new SelectionAdapter() { |
... | ... | |
205 | 204 |
btnRefresh.setLayoutData(gd_btnRefresh); |
206 | 205 |
btnRefresh.setText("Refresh"); |
207 | 206 |
} |
208 |
new Label(container, SWT.NONE); |
|
209 |
new Label(container, SWT.NONE); |
|
210 |
new Label(container, SWT.NONE); |
|
211 |
new Label(container, SWT.NONE); |
|
212 |
new Label(container, SWT.NONE); |
|
213 |
|
|
214 |
{ |
|
215 |
tableSessions = new Table(container, SWT.BORDER | SWT.FULL_SELECTION); |
|
216 |
tableSessions.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1)); |
|
217 |
tableSessions.setHeaderVisible(true); |
|
218 |
tableSessions.setLinesVisible(true); |
|
207 |
{ |
|
208 |
Button btnInspectActiveSession = new Button(container, SWT.NONE); |
|
209 |
btnInspectActiveSession.addSelectionListener(new SelectionAdapter() { |
|
210 |
@Override |
|
211 |
public void widgetSelected(SelectionEvent e) { |
|
212 |
AbstractUtility.executeCommand(OPEN_INSPECT_SESSIONS_DIALOG_ID, this, null); |
|
219 | 213 |
} |
220 |
new Label(container, SWT.NONE); |
|
214 |
}); |
|
215 |
btnInspectActiveSession.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); |
|
216 |
btnInspectActiveSession.setText("Inspect Active Session"); |
|
217 |
} |
|
218 |
new Label(container, SWT.NONE); |
|
219 |
new Label(container, SWT.NONE); |
|
220 |
|
|
221 |
{ |
|
222 |
tableSessions = new Table(container, SWT.BORDER | SWT.FULL_SELECTION); |
|
223 |
GridData gd_tableSessions = new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1); |
|
224 |
gd_tableSessions.widthHint = 769; |
|
225 |
tableSessions.setLayoutData(gd_tableSessions); |
|
226 |
tableSessions.setHeaderVisible(true); |
|
227 |
tableSessions.setLinesVisible(true); |
|
228 |
} |
|
221 | 229 |
|
222 | 230 |
createActions(); |
223 | 231 |
initializeToolBar(); |
... | ... | |
231 | 239 |
|
232 | 240 |
|
233 | 241 |
for (String title : titles) { |
234 |
TableColumn column = new TableColumn(tableSessions, SWT.NULL); |
|
235 |
column.setWidth(200); |
|
236 |
column.setText(title); |
|
242 |
TableColumn column = new TableColumn(tableSessions, SWT.NULL);
|
|
243 |
column.setWidth(200);
|
|
244 |
column.setText(title);
|
|
237 | 245 |
} |
238 | 246 |
changed(); |
239 | 247 |
|
... | ... | |
242 | 250 |
|
243 | 251 |
@Override |
244 | 252 |
public void changed() { |
253 |
if(tableSessions.isDisposed()) { |
|
254 |
return; |
|
255 |
} |
|
245 | 256 |
tableSessions.removeAll(); |
246 | 257 |
if(cdmEntitySessionManager != null) { |
247 | 258 |
Collection<ICdmEntitySession> sessions = cdmEntitySessionManager.getSessions(); |
Also available in: Unified diff
OpenInspectSessionsHandler : handler for opening the inspect session dialog
CacheLoader : moved recursive logic from cdm transient cacher to new class
CdmServiceCacher : now uses CacheLoader to recursively load entities
CdmTransientEntityCacher : moved recursive logic from cdm transient cacher to new class and corrected caching issues
EntityCacherDebugResult : corrected recursion and added getter method for debug output
CdmEntitySessionManager : now sets active session to null when it is disposed
remotingApplicationContext.xml : corrected exclude
AbstractUtility : new utility method to execute handler
InspectSessionsDialog : added debug text info and cosmetic changes
SessionsViewPart : now opens inspect sessions dialog on button push