]>
git.argeo.org Git - gpl/argeo-suite.git/blob - app/swt/ux/DefaultLoginScreen.java
1 package org
.argeo
.app
.swt
.ux
;
3 import org
.argeo
.api
.acr
.Content
;
4 import org
.argeo
.api
.cms
.CmsContext
;
5 import org
.argeo
.api
.cms
.ux
.CmsView
;
6 import org
.argeo
.cms
.CurrentUser
;
7 import org
.argeo
.cms
.swt
.CmsSwtUtils
;
8 import org
.argeo
.cms
.swt
.acr
.SwtUiProvider
;
9 import org
.argeo
.cms
.swt
.auth
.CmsLogin
;
10 import org
.eclipse
.swt
.SWT
;
11 import org
.eclipse
.swt
.layout
.GridData
;
12 import org
.eclipse
.swt
.layout
.GridLayout
;
13 import org
.eclipse
.swt
.widgets
.Composite
;
14 import org
.eclipse
.swt
.widgets
.Control
;
16 /** Provides a login screen. */
17 public class DefaultLoginScreen
implements SwtUiProvider
{
18 private CmsContext cmsContext
;
21 public Control
createUiPart(Composite parent
, Content context
) {
22 CmsView cmsView
= CmsSwtUtils
.getCmsView(parent
);
23 if (!cmsView
.isAnonymous())
24 throw new IllegalStateException(CurrentUser
.getUsername() + " is already logged in");
26 parent
.setLayout(new GridLayout());
27 Composite loginArea
= new Composite(parent
, SWT
.NONE
);
28 loginArea
.setLayoutData(new GridData(SWT
.CENTER
, SWT
.CENTER
, true, true));
30 CmsLogin cmsLogin
= new CmsLogin(cmsView
, cmsContext
);
31 cmsLogin
.createUi(loginArea
);
32 return cmsLogin
.getCredentialsBlock();
35 public void setCmsContext(CmsContext cmsContext
) {
36 this.cmsContext
= cmsContext
;