code cleanup

This commit is contained in:
anhefti 2020-03-05 16:05:56 +01:00
parent df884bd8d2
commit 884f9c78e0
40 changed files with 4320 additions and 4290 deletions

View file

@ -101,15 +101,15 @@ public class ExamForm implements TemplateComposer {
new LocTextKey("sebserver.exam.form.status"); new LocTextKey("sebserver.exam.form.status");
private static final LocTextKey FORM_TYPE_TEXT_KEY = private static final LocTextKey FORM_TYPE_TEXT_KEY =
new LocTextKey("sebserver.exam.form.type"); new LocTextKey("sebserver.exam.form.type");
private static final LocTextKey FORM_ENDTIME_TEXT_KEY = private static final LocTextKey FORM_END_TIME_TEXT_KEY =
new LocTextKey("sebserver.exam.form.endtime"); new LocTextKey("sebserver.exam.form.endtime");
private static final LocTextKey FORM_STARTTIME_TEXT_KEY = private static final LocTextKey FORM_START_TIME_TEXT_KEY =
new LocTextKey("sebserver.exam.form.starttime"); new LocTextKey("sebserver.exam.form.starttime");
private static final LocTextKey FORM_DESCRIPTION_TEXT_KEY = private static final LocTextKey FORM_DESCRIPTION_TEXT_KEY =
new LocTextKey("sebserver.exam.form.description"); new LocTextKey("sebserver.exam.form.description");
private static final LocTextKey FORM_NAME_TEXT_KEY = private static final LocTextKey FORM_NAME_TEXT_KEY =
new LocTextKey("sebserver.exam.form.name"); new LocTextKey("sebserver.exam.form.name");
private static final LocTextKey FORM_QUIZID_TEXT_KEY = private static final LocTextKey FORM_QUIZ_ID_TEXT_KEY =
new LocTextKey("sebserver.exam.form.quizid"); new LocTextKey("sebserver.exam.form.quizid");
private static final LocTextKey FORM_QUIZ_URL_TEXT_KEY = private static final LocTextKey FORM_QUIZ_URL_TEXT_KEY =
new LocTextKey("sebserver.exam.form.quizurl"); new LocTextKey("sebserver.exam.form.quizurl");
@ -285,14 +285,14 @@ public class ExamForm implements TemplateComposer {
.addField(FormBuilder.text( .addField(FormBuilder.text(
QuizData.QUIZ_ATTR_START_TIME, QuizData.QUIZ_ATTR_START_TIME,
FORM_STARTTIME_TEXT_KEY, FORM_START_TIME_TEXT_KEY,
i18nSupport.formatDisplayDateWithTimeZone(exam.startTime)) i18nSupport.formatDisplayDateWithTimeZone(exam.startTime))
.readonly(true) .readonly(true)
.withInputSpan(3) .withInputSpan(3)
.withEmptyCellSeparation(false)) .withEmptyCellSeparation(false))
.addField(FormBuilder.text( .addField(FormBuilder.text(
QuizData.QUIZ_ATTR_END_TIME, QuizData.QUIZ_ATTR_END_TIME,
FORM_ENDTIME_TEXT_KEY, FORM_END_TIME_TEXT_KEY,
i18nSupport.formatDisplayDateWithTimeZone(exam.endTime)) i18nSupport.formatDisplayDateWithTimeZone(exam.endTime))
.readonly(true) .readonly(true)
.withInputSpan(3) .withInputSpan(3)
@ -300,7 +300,7 @@ public class ExamForm implements TemplateComposer {
.addField(FormBuilder.text( .addField(FormBuilder.text(
Domain.EXAM.ATTR_EXTERNAL_ID, Domain.EXAM.ATTR_EXTERNAL_ID,
FORM_QUIZID_TEXT_KEY, FORM_QUIZ_ID_TEXT_KEY,
exam.externalId) exam.externalId)
.readonly(true) .readonly(true)
.withEmptyCellSeparation(false)) .withEmptyCellSeparation(false))

View file

@ -62,11 +62,11 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant;
@GuiProfile @GuiProfile
public class ExamList implements TemplateComposer { public class ExamList implements TemplateComposer {
static final String EXAM_LIST_COLUMN_STARTTIME = static final String EXAM_LIST_COLUMN_START_TIME =
"sebserver.exam.list.column.starttime"; "sebserver.exam.list.column.starttime";
static final LocTextKey PAGE_TITLE_KEY = static final LocTextKey PAGE_TITLE_KEY =
new LocTextKey("sebserver.exam.list.title"); new LocTextKey("sebserver.exam.list.title");
static final LocTextKey NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUION = static final LocTextKey NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION =
new LocTextKey("sebserver.exam.list.action.no.modify.privilege"); new LocTextKey("sebserver.exam.list.action.no.modify.privilege");
final static LocTextKey EMPTY_SELECTION_TEXT_KEY = final static LocTextKey EMPTY_SELECTION_TEXT_KEY =
new LocTextKey("sebserver.exam.info.pleaseSelect"); new LocTextKey("sebserver.exam.info.pleaseSelect");
@ -175,7 +175,7 @@ public class ExamList implements TemplateComposer {
.withColumn(new ColumnDefinition<>( .withColumn(new ColumnDefinition<>(
QuizData.QUIZ_ATTR_START_TIME, QuizData.QUIZ_ATTR_START_TIME,
new LocTextKey( new LocTextKey(
EXAM_LIST_COLUMN_STARTTIME, EXAM_LIST_COLUMN_START_TIME,
i18nSupport.getUsersTimeZoneTitleSuffix()), i18nSupport.getUsersTimeZoneTitleSuffix()),
Exam::getStartTime) Exam::getStartTime)
.withFilter(new TableFilterAttribute( .withFilter(new TableFilterAttribute(
@ -213,7 +213,7 @@ public class ExamList implements TemplateComposer {
.newAction(ActionDefinition.EXAM_MODIFY_FROM_LIST) .newAction(ActionDefinition.EXAM_MODIFY_FROM_LIST)
.withSelect( .withSelect(
table.getGrantedSelection(currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUION), table.getGrantedSelection(currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
action -> modifyExam(action, table), action -> modifyExam(action, table),
EMPTY_SELECTION_TEXT_KEY) EMPTY_SELECTION_TEXT_KEY)
.publishIf(() -> userGrant.im() && table.hasAnyContent(), false); .publishIf(() -> userGrant.im() && table.hasAnyContent(), false);

View file

@ -46,7 +46,7 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
@GuiProfile @GuiProfile
public class LmsSetupList implements TemplateComposer { public class LmsSetupList implements TemplateComposer {
private static final LocTextKey NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUION = private static final LocTextKey NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION =
new LocTextKey("sebserver.lmssetup.list.action.no.modify.privilege"); new LocTextKey("sebserver.lmssetup.list.action.no.modify.privilege");
private static final LocTextKey EMPTY_SELECTION_TEXT_KEY = private static final LocTextKey EMPTY_SELECTION_TEXT_KEY =
new LocTextKey("sebserver.lmssetup.info.pleaseSelect"); new LocTextKey("sebserver.lmssetup.info.pleaseSelect");
@ -173,7 +173,7 @@ public class LmsSetupList implements TemplateComposer {
.newAction(ActionDefinition.LMS_SETUP_MODIFY_FROM_LIST) .newAction(ActionDefinition.LMS_SETUP_MODIFY_FROM_LIST)
.withSelect( .withSelect(
table.getGrantedSelection(currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUION), table.getGrantedSelection(currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY) PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY)
.publishIf(() -> userGrant.im() && table.hasAnyContent(), false) .publishIf(() -> userGrant.im() && table.hasAnyContent(), false)

View file

@ -48,19 +48,19 @@ public class LoginPage implements TemplateComposer {
private final WidgetFactory widgetFactory; private final WidgetFactory widgetFactory;
private final I18nSupport i18nSupport; private final I18nSupport i18nSupport;
private final DefaultRegisterPage defaultRegisterPage; private final DefaultRegisterPage defaultRegisterPage;
private final boolean registreringEnabled; private final boolean registeringEnabled;
public LoginPage( public LoginPage(
final PageService pageService, final PageService pageService,
final DefaultRegisterPage defaultRegisterPage, final DefaultRegisterPage defaultRegisterPage,
@Value("${sebserver.gui.self-registering:false}") final Boolean registreringEnabled) { @Value("${sebserver.gui.self-registering:false}") final Boolean registeringEnabled) {
this.pageService = pageService; this.pageService = pageService;
this.authorizationContextHolder = pageService.getAuthorizationContextHolder(); this.authorizationContextHolder = pageService.getAuthorizationContextHolder();
this.widgetFactory = pageService.getWidgetFactory(); this.widgetFactory = pageService.getWidgetFactory();
this.i18nSupport = pageService.getI18nSupport(); this.i18nSupport = pageService.getI18nSupport();
this.defaultRegisterPage = defaultRegisterPage; this.defaultRegisterPage = defaultRegisterPage;
this.registreringEnabled = BooleanUtils.toBoolean(registreringEnabled); this.registeringEnabled = BooleanUtils.toBoolean(registeringEnabled);
} }
@Override @Override
@ -100,13 +100,11 @@ public class LoginPage implements TemplateComposer {
gridData = new GridData(SWT.LEFT, SWT.TOP, false, false); gridData = new GridData(SWT.LEFT, SWT.TOP, false, false);
gridData.verticalIndent = 10; gridData.verticalIndent = 10;
loginButton.setLayoutData(gridData); loginButton.setLayoutData(gridData);
loginButton.addListener(SWT.Selection, event -> { loginButton.addListener(SWT.Selection, event -> login(
login(
pageContext, pageContext,
loginName.getText(), loginName.getText(),
loginPassword.getText(), loginPassword.getText(),
authorizationContext); authorizationContext));
});
loginName.addListener(SWT.KeyDown, event -> { loginName.addListener(SWT.KeyDown, event -> {
if (event.character == '\n' || event.character == '\r') { if (event.character == '\n' || event.character == '\r') {
if (StringUtils.isNotBlank(loginPassword.getText())) { if (StringUtils.isNotBlank(loginPassword.getText())) {
@ -134,14 +132,12 @@ public class LoginPage implements TemplateComposer {
} }
}); });
if (this.registreringEnabled) { if (this.registeringEnabled) {
final Button registerButton = this.widgetFactory.buttonLocalized(buttons, "sebserver.login.register"); final Button registerButton = this.widgetFactory.buttonLocalized(buttons, "sebserver.login.register");
gridData = new GridData(SWT.LEFT, SWT.TOP, false, false); gridData = new GridData(SWT.LEFT, SWT.TOP, false, false);
gridData.verticalIndent = 10; gridData.verticalIndent = 10;
registerButton.setLayoutData(gridData); registerButton.setLayoutData(gridData);
registerButton.addListener(SWT.Selection, event -> { registerButton.addListener(SWT.Selection, event -> pageContext.forwardToPage(this.defaultRegisterPage));
pageContext.forwardToPage(this.defaultRegisterPage);
});
} }
} }
@ -151,11 +147,10 @@ public class LoginPage implements TemplateComposer {
final CharSequence loginPassword, final CharSequence loginPassword,
final SEBServerAuthorizationContext authorizationContext) { final SEBServerAuthorizationContext authorizationContext) {
final String username = loginName;
try { try {
final boolean loggedIn = authorizationContext.login( final boolean loggedIn = authorizationContext.login(
username, loginName,
loginPassword); loginPassword);
if (loggedIn) { if (loggedIn) {
@ -179,7 +174,7 @@ public class LoginPage implements TemplateComposer {
loginError(pageContext, "sebserver.login.failed.message"); loginError(pageContext, "sebserver.login.failed.message");
} }
} catch (final Exception e) { } catch (final Exception e) {
log.error("Unexpected error while trying to login with user: {}", username, e); log.error("Unexpected error while trying to login with user: {}", loginName, e);
loginError(pageContext, "Unexpected Error. Please call an Administrator"); loginError(pageContext, "Unexpected Error. Please call an Administrator");
} }
} }

View file

@ -88,10 +88,10 @@ public class MainPage implements TemplateComposer {
scrolledComposite -> { scrolledComposite -> {
final Composite result = new Composite(scrolledComposite, SWT.NONE); final Composite result = new Composite(scrolledComposite, SWT.NONE);
result.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); result.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
final GridLayout contentOuterlayout = new GridLayout(); final GridLayout contentOuterLayout = new GridLayout();
contentOuterlayout.marginHeight = 0; contentOuterLayout.marginHeight = 0;
contentOuterlayout.marginWidth = 0; contentOuterLayout.marginWidth = 0;
result.setLayout(contentOuterlayout); result.setLayout(contentOuterLayout);
return result; return result;
}, },
false); false);
@ -126,10 +126,10 @@ public class MainPage implements TemplateComposer {
final Composite contentObjects = new Composite(content, SWT.NONE); final Composite contentObjects = new Composite(content, SWT.NONE);
contentObjects.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); contentObjects.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final GridLayout contentObjectslayout = new GridLayout(); final GridLayout contentObjectsLayout = new GridLayout();
contentObjectslayout.marginHeight = 0; contentObjectsLayout.marginHeight = 0;
contentObjectslayout.marginWidth = 0; contentObjectsLayout.marginWidth = 0;
contentObjects.setLayout(contentObjectslayout); contentObjects.setLayout(contentObjectsLayout);
contentObjects.setData( contentObjects.setData(
PageEventListener.LISTENER_ATTRIBUTE_KEY, PageEventListener.LISTENER_ATTRIBUTE_KEY,
new ContentActionEventListener(event -> pageContext new ContentActionEventListener(event -> pageContext

View file

@ -240,8 +240,8 @@ public class QuizDiscoveryList implements TemplateComposer {
} }
private static Function<QuizData, String> quizDataLmsSetupNameFunction(final ResourceService resourceService) { private static Function<QuizData, String> quizDataLmsSetupNameFunction(final ResourceService resourceService) {
return quizzData -> resourceService.getLmsSetupNameFunction() return quizData -> resourceService.getLmsSetupNameFunction()
.apply(String.valueOf(quizzData.lmsSetupId)); .apply(String.valueOf(quizData.lmsSetupId));
} }
private PageAction importQuizData(final PageAction action, final EntityTable<QuizData> table) { private PageAction importQuizData(final PageAction action, final EntityTable<QuizData> table) {

View file

@ -247,9 +247,7 @@ public class RegisterPage implements TemplateComposer {
gridData = new GridData(SWT.LEFT, SWT.TOP, false, false); gridData = new GridData(SWT.LEFT, SWT.TOP, false, false);
gridData.verticalIndent = 10; gridData.verticalIndent = 10;
cancelButton.setLayoutData(gridData); cancelButton.setLayoutData(gridData);
cancelButton.addListener(SWT.Selection, event -> { cancelButton.addListener(SWT.Selection, event -> pageContext.forwardToLoginPage());
pageContext.forwardToLoginPage();
});
} }

View file

@ -48,7 +48,7 @@ import ch.ethz.seb.sebserver.gui.table.TableFilter.CriteriaType;
@GuiProfile @GuiProfile
public class SebClientConfigList implements TemplateComposer { public class SebClientConfigList implements TemplateComposer {
private static final LocTextKey NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUION = private static final LocTextKey NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION =
new LocTextKey("sebserver.clientconfig.list.action.no.modify.privilege"); new LocTextKey("sebserver.clientconfig.list.action.no.modify.privilege");
private static final LocTextKey EMPTY_LIST_TEXT_KEY = private static final LocTextKey EMPTY_LIST_TEXT_KEY =
new LocTextKey("sebserver.clientconfig.list.empty"); new LocTextKey("sebserver.clientconfig.list.empty");
@ -176,7 +176,7 @@ public class SebClientConfigList implements TemplateComposer {
.newAction(ActionDefinition.SEB_CLIENT_CONFIG_MODIFY_FROM_LIST) .newAction(ActionDefinition.SEB_CLIENT_CONFIG_MODIFY_FROM_LIST)
.withSelect( .withSelect(
table.getGrantedSelection(this.currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUION), table.getGrantedSelection(this.currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY) PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY)
.publishIf(() -> clientConfigGrant.im() && table.hasAnyContent(), false) .publishIf(() -> clientConfigGrant.im() && table.hasAnyContent(), false)

View file

@ -81,7 +81,7 @@ final class SebExamConfigImportPopup {
}; };
} }
private static final boolean doImport( private static boolean doImport(
final PageService pageService, final PageService pageService,
final FormHandle<ConfigurationNode> formHandle, final FormHandle<ConfigurationNode> formHandle,
final boolean newConfig) { final boolean newConfig) {
@ -93,7 +93,7 @@ final class SebExamConfigImportPopup {
final PageContext context = formHandle.getContext(); final PageContext context = formHandle.getContext();
// Ad-hoc field validation // Ad-hoc field validation
formHandle.process(name -> true, field -> field.resetError()); formHandle.process(name -> true, Form.FormFieldAccessor::resetError);
final String fieldValue = form.getFieldValue(Domain.CONFIGURATION_NODE.ATTR_NAME); final String fieldValue = form.getFieldValue(Domain.CONFIGURATION_NODE.ATTR_NAME);
if (StringUtils.isBlank(fieldValue)) { if (StringUtils.isBlank(fieldValue)) {
form.setFieldError( form.setFieldError(
@ -116,7 +116,7 @@ final class SebExamConfigImportPopup {
return false; return false;
} }
if (fieldControl != null && fieldControl instanceof FileUploadSelection) { if (fieldControl instanceof FileUploadSelection) {
final FileUploadSelection fileUpload = (FileUploadSelection) fieldControl; final FileUploadSelection fileUpload = (FileUploadSelection) fieldControl;
final InputStream inputStream = fileUpload.getInputStream(); final InputStream inputStream = fileUpload.getInputStream();
if (inputStream != null) { if (inputStream != null) {
@ -162,7 +162,6 @@ final class SebExamConfigImportPopup {
new ActionEvent(action), new ActionEvent(action),
action.pageContext()); action.pageContext());
} }
return true;
} else { } else {
final Exception error = configuration.getError(); final Exception error = configuration.getError();
if (error instanceof RestCallError) { if (error instanceof RestCallError) {
@ -188,12 +187,12 @@ final class SebExamConfigImportPopup {
SebExamConfigPropForm.FORM_TITLE, SebExamConfigPropForm.FORM_TITLE,
configuration.getError()); configuration.getError());
return true;
} }
return true;
} else { } else {
formHandle.getContext().publishPageMessage( formHandle.getContext().publishPageMessage(
new LocTextKey("sebserver.error.unexpected"), new LocTextKey("sebserver.error.unexpected"),
new LocTextKey("Please selecte a valid SEB Exam Configuration File")); new LocTextKey("Please select a valid SEB Exam Configuration File"));
} }
} }
@ -271,7 +270,7 @@ final class SebExamConfigImportPopup {
void cancelUpload() { void cancelUpload() {
if (this.form != null) { if (this.form != null) {
final Control fieldControl = this.form.getFieldInput(API.IMPORT_FILE_ATTR_NAME); final Control fieldControl = this.form.getFieldInput(API.IMPORT_FILE_ATTR_NAME);
if (fieldControl != null && fieldControl instanceof FileUploadSelection) { if (fieldControl instanceof FileUploadSelection) {
((FileUploadSelection) fieldControl).close(); ((FileUploadSelection) fieldControl).close();
} }
} }

View file

@ -43,7 +43,7 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
@GuiProfile @GuiProfile
public class SebExamConfigList implements TemplateComposer { public class SebExamConfigList implements TemplateComposer {
private static final LocTextKey NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUION = private static final LocTextKey NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION =
new LocTextKey("sebserver.examconfig.list.action.no.modify.privilege"); new LocTextKey("sebserver.examconfig.list.action.no.modify.privilege");
private static final LocTextKey EMPTY_CONFIG_LIST_TEXT_KEY = private static final LocTextKey EMPTY_CONFIG_LIST_TEXT_KEY =
new LocTextKey("sebserver.examconfig.list.empty"); new LocTextKey("sebserver.examconfig.list.empty");
@ -165,7 +165,7 @@ public class SebExamConfigList implements TemplateComposer {
.newAction(ActionDefinition.SEB_EXAM_CONFIG_MODIFY_PROP_FROM_LIST) .newAction(ActionDefinition.SEB_EXAM_CONFIG_MODIFY_PROP_FROM_LIST)
.withSelect( .withSelect(
configTable.getGrantedSelection(this.currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUION), configTable.getGrantedSelection(this.currentUser, NO_MODIFY_PRIVILEGE_ON_OTHER_INSTITUTION),
PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY) PageAction::applySingleSelectionAsEntityKey, EMPTY_SELECTION_TEXT_KEY)
.publishIf(() -> examConfigGrant.im() && configTable.hasAnyContent(), false) .publishIf(() -> examConfigGrant.im() && configTable.hasAnyContent(), false)

View file

@ -265,7 +265,7 @@ public class SebExamConfigPropForm implements TemplateComposer {
.noEventPropagation() .noEventPropagation()
.publishIf(() -> modifyGrant && isReadonly) .publishIf(() -> modifyGrant && isReadonly)
.newAction(ActionDefinition.SEB_EXAM_CONFIG_COPY_CONFIG_AS_TEMPALTE) .newAction(ActionDefinition.SEA_EXAM_CONFIG_COPY_CONFIG_AS_TEMPLATE)
.withEntityKey(entityKey) .withEntityKey(entityKey)
.withExec(SebExamConfigCreationPopup.configCreationFunction( .withExec(SebExamConfigCreationPopup.configCreationFunction(
this.pageService, this.pageService,
@ -313,7 +313,7 @@ public class SebExamConfigPropForm implements TemplateComposer {
.withColumn(new ColumnDefinition<>( .withColumn(new ColumnDefinition<>(
QuizData.QUIZ_ATTR_START_TIME, QuizData.QUIZ_ATTR_START_TIME,
new LocTextKey( new LocTextKey(
ExamList.EXAM_LIST_COLUMN_STARTTIME, ExamList.EXAM_LIST_COLUMN_START_TIME,
this.pageService.getI18nSupport().getUsersTimeZoneTitleSuffix()), this.pageService.getI18nSupport().getUsersTimeZoneTitleSuffix()),
ExamConfigurationMap::getExamStartTime)) ExamConfigurationMap::getExamStartTime))

View file

@ -190,7 +190,7 @@ public class SebExamConfigSettingsForm implements TemplateComposer {
.ignoreMoveAwayFromEdit() .ignoreMoveAwayFromEdit()
.publishIf(() -> examConfigGrant.iw() && !readonly) .publishIf(() -> examConfigGrant.iw() && !readonly)
.newAction(ActionDefinition.SEB_EXAM_CONFIG_COPY_CONFIG_AS_TEMPALTE) .newAction(ActionDefinition.SEA_EXAM_CONFIG_COPY_CONFIG_AS_TEMPLATE)
.withEntityKey(entityKey) .withEntityKey(entityKey)
.withExec(SebExamConfigCreationPopup.configCreationFunction( .withExec(SebExamConfigCreationPopup.configCreationFunction(
this.pageService, this.pageService,

View file

@ -33,7 +33,7 @@ public enum ActionCategory {
public final LocTextKey title; public final LocTextKey title;
public final int slotPosition; public final int slotPosition;
private ActionCategory(final LocTextKey title, final int slotPosition) { ActionCategory(final LocTextKey title, final int slotPosition) {
this.title = title; this.title = title;
this.slotPosition = slotPosition; this.slotPosition = slotPosition;
} }

View file

@ -467,7 +467,7 @@ public enum ActionDefinition {
new LocTextKey("sebserver.examconfig.action.copy"), new LocTextKey("sebserver.examconfig.action.copy"),
ImageIcon.COPY, ImageIcon.COPY,
ActionCategory.FORM), ActionCategory.FORM),
SEB_EXAM_CONFIG_COPY_CONFIG_AS_TEMPALTE( SEA_EXAM_CONFIG_COPY_CONFIG_AS_TEMPLATE(
new LocTextKey("sebserver.examconfig.action.copy-as-template"), new LocTextKey("sebserver.examconfig.action.copy-as-template"),
ImageIcon.TEMPLATE, ImageIcon.TEMPLATE,
ActionCategory.FORM), ActionCategory.FORM),

View file

@ -8,10 +8,17 @@
package ch.ethz.seb.sebserver.gui.content.action; package ch.ethz.seb.sebserver.gui.content.action;
import java.util.ArrayList; import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
import java.util.HashMap; import ch.ethz.seb.sebserver.gui.service.i18n.PolyglotPageService;
import java.util.Map; import ch.ethz.seb.sebserver.gui.service.page.PageContext;
import ch.ethz.seb.sebserver.gui.service.page.PageService;
import ch.ethz.seb.sebserver.gui.service.page.TemplateComposer;
import ch.ethz.seb.sebserver.gui.service.page.event.ActionActivationEventListener;
import ch.ethz.seb.sebserver.gui.service.page.event.ActionPublishEventListener;
import ch.ethz.seb.sebserver.gui.service.page.event.PageEventListener;
import ch.ethz.seb.sebserver.gui.service.page.impl.PageAction;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.eclipse.rap.rwt.RWT; import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.template.ImageCell; import org.eclipse.rap.rwt.template.ImageCell;
@ -31,19 +38,9 @@ import org.eclipse.swt.widgets.TreeItem;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; import java.util.ArrayList;
import ch.ethz.seb.sebserver.gui.service.i18n.PolyglotPageService; import java.util.HashMap;
import ch.ethz.seb.sebserver.gui.service.page.PageContext; import java.util.Map;
import ch.ethz.seb.sebserver.gui.service.page.PageService;
import ch.ethz.seb.sebserver.gui.service.page.TemplateComposer;
import ch.ethz.seb.sebserver.gui.service.page.event.ActionActivationEvent;
import ch.ethz.seb.sebserver.gui.service.page.event.ActionActivationEventListener;
import ch.ethz.seb.sebserver.gui.service.page.event.ActionPublishEvent;
import ch.ethz.seb.sebserver.gui.service.page.event.ActionPublishEventListener;
import ch.ethz.seb.sebserver.gui.service.page.event.PageEventListener;
import ch.ethz.seb.sebserver.gui.service.page.impl.PageAction;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant;
@Lazy @Lazy
@Component @Component

View file

@ -96,7 +96,7 @@ public class ActivitiesPane implements TemplateComposer {
.hasAnyRole(UserRole.SEB_SERVER_ADMIN, UserRole.INSTITUTIONAL_ADMIN); .hasAnyRole(UserRole.SEB_SERVER_ADMIN, UserRole.INSTITUTIONAL_ADMIN);
// SEB Server Administration // SEB Server Administration
final TreeItem sebadmin = this.widgetFactory.treeItemLocalized( final TreeItem sebAdmin = this.widgetFactory.treeItemLocalized(
navigation, navigation,
ActivityDefinition.SEB_ADMINISTRATION.displayName); ActivityDefinition.SEB_ADMINISTRATION.displayName);
@ -105,7 +105,7 @@ public class ActivitiesPane implements TemplateComposer {
if (userInfo.hasRole(UserRole.SEB_SERVER_ADMIN)) { if (userInfo.hasRole(UserRole.SEB_SERVER_ADMIN)) {
// institutions (list) as root // institutions (list) as root
final TreeItem institutions = this.widgetFactory.treeItemLocalized( final TreeItem institutions = this.widgetFactory.treeItemLocalized(
sebadmin, sebAdmin,
ActivityDefinition.INSTITUTION.displayName); ActivityDefinition.INSTITUTION.displayName);
injectActivitySelection( injectActivitySelection(
institutions, institutions,
@ -116,7 +116,7 @@ public class ActivitiesPane implements TemplateComposer {
} else if (userInfo.hasRole(UserRole.INSTITUTIONAL_ADMIN)) { } else if (userInfo.hasRole(UserRole.INSTITUTIONAL_ADMIN)) {
// otherwise show the form of the institution for current user // otherwise show the form of the institution for current user
final TreeItem institutions = this.widgetFactory.treeItemLocalized( final TreeItem institutions = this.widgetFactory.treeItemLocalized(
sebadmin, sebAdmin,
ActivityDefinition.INSTITUTION.displayName); ActivityDefinition.INSTITUTION.displayName);
injectActivitySelection( injectActivitySelection(
institutions, institutions,
@ -131,7 +131,7 @@ public class ActivitiesPane implements TemplateComposer {
if (isServerOrInstAdmin) { if (isServerOrInstAdmin) {
final TreeItem userAccounts = this.widgetFactory.treeItemLocalized( final TreeItem userAccounts = this.widgetFactory.treeItemLocalized(
sebadmin, sebAdmin,
ActivityDefinition.USER_ACCOUNT.displayName); ActivityDefinition.USER_ACCOUNT.displayName);
injectActivitySelection( injectActivitySelection(
userAccounts, userAccounts,
@ -157,7 +157,7 @@ public class ActivitiesPane implements TemplateComposer {
EntityType.USER_ACTIVITY_LOG); EntityType.USER_ACTIVITY_LOG);
if (viewUserActivityLogs) { if (viewUserActivityLogs) {
final TreeItem activityLogs = this.widgetFactory.treeItemLocalized( final TreeItem activityLogs = this.widgetFactory.treeItemLocalized(
sebadmin, sebAdmin,
ActivityDefinition.USER_ACTIVITY_LOGS.displayName); ActivityDefinition.USER_ACTIVITY_LOGS.displayName);
injectActivitySelection( injectActivitySelection(
activityLogs, activityLogs,
@ -166,12 +166,12 @@ public class ActivitiesPane implements TemplateComposer {
.create()); .create());
} }
if (sebadmin.getItemCount() > 0) { if (sebAdmin.getItemCount() > 0) {
sebadmin.setExpanded(this.currentUser.get().hasAnyRole( sebAdmin.setExpanded(this.currentUser.get().hasAnyRole(
UserRole.SEB_SERVER_ADMIN, UserRole.SEB_SERVER_ADMIN,
UserRole.INSTITUTIONAL_ADMIN)); UserRole.INSTITUTIONAL_ADMIN));
} else { } else {
sebadmin.dispose(); sebAdmin.dispose();
} }
// ---- SEB ADMIN ---------------------------------------------------------------------- // ---- SEB ADMIN ----------------------------------------------------------------------
@ -244,7 +244,7 @@ public class ActivitiesPane implements TemplateComposer {
final boolean examWrite = this.currentUser.hasInstitutionalPrivilege(PrivilegeType.WRITE, EntityType.EXAM); final boolean examWrite = this.currentUser.hasInstitutionalPrivilege(PrivilegeType.WRITE, EntityType.EXAM);
// Exam Administration // Exam Administration
final TreeItem examadmin = this.widgetFactory.treeItemLocalized( final TreeItem examAdmin = this.widgetFactory.treeItemLocalized(
navigation, navigation,
ActivityDefinition.EXAM_ADMINISTRATION.displayName); ActivityDefinition.EXAM_ADMINISTRATION.displayName);
@ -252,7 +252,7 @@ public class ActivitiesPane implements TemplateComposer {
// LMS Setup // LMS Setup
if (lmsRead && !isSupporterOnly) { if (lmsRead && !isSupporterOnly) {
final TreeItem lmsSetup = this.widgetFactory.treeItemLocalized( final TreeItem lmsSetup = this.widgetFactory.treeItemLocalized(
examadmin, examAdmin,
ActivityDefinition.LMS_SETUP.displayName); ActivityDefinition.LMS_SETUP.displayName);
injectActivitySelection( injectActivitySelection(
lmsSetup, lmsSetup,
@ -266,7 +266,7 @@ public class ActivitiesPane implements TemplateComposer {
if (examWrite) { if (examWrite) {
// Quiz Discovery // Quiz Discovery
final TreeItem quizDiscovery = this.widgetFactory.treeItemLocalized( final TreeItem quizDiscovery = this.widgetFactory.treeItemLocalized(
examadmin, examAdmin,
ActivityDefinition.QUIZ_DISCOVERY.displayName); ActivityDefinition.QUIZ_DISCOVERY.displayName);
injectActivitySelection( injectActivitySelection(
quizDiscovery, quizDiscovery,
@ -277,7 +277,7 @@ public class ActivitiesPane implements TemplateComposer {
// Exam // Exam
final TreeItem exam = this.widgetFactory.treeItemLocalized( final TreeItem exam = this.widgetFactory.treeItemLocalized(
examadmin, examAdmin,
ActivityDefinition.EXAM.displayName); ActivityDefinition.EXAM.displayName);
injectActivitySelection( injectActivitySelection(
exam, exam,
@ -286,7 +286,7 @@ public class ActivitiesPane implements TemplateComposer {
.create()); .create());
} }
examadmin.setExpanded(this.currentUser.get().hasAnyRole(UserRole.EXAM_ADMIN)); examAdmin.setExpanded(this.currentUser.get().hasAnyRole(UserRole.EXAM_ADMIN));
} }
// ---- EXAM ADMINISTRATION ------------------------------------------------------------ // ---- EXAM ADMINISTRATION ------------------------------------------------------------
@ -388,9 +388,7 @@ public class ActivitiesPane implements TemplateComposer {
state.activityAnchor()); state.activityAnchor());
if (item != null) { if (item != null) {
final PageAction action = getActivitySelection(item); final PageAction action = getActivitySelection(item);
this.pageService.executePageAction(action, result -> { this.pageService.executePageAction(action, result -> navigation.select(item));
navigation.select(item);
});
} }
} }
} }
@ -491,7 +489,7 @@ public class ActivitiesPane implements TemplateComposer {
}); });
} }
private static final boolean isInSubTree(final TreeItem treeItem, final TreeItem currentSelection) { private static boolean isInSubTree(final TreeItem treeItem, final TreeItem currentSelection) {
if (treeItem == null) { if (treeItem == null) {
return false; return false;
} }
@ -510,7 +508,7 @@ public class ActivitiesPane implements TemplateComposer {
return false; return false;
} }
private static final TreeItem findItemByActionDefinition( private static TreeItem findItemByActionDefinition(
final TreeItem[] items, final TreeItem[] items,
final Activity activity) { final Activity activity) {
@ -544,7 +542,7 @@ public class ActivitiesPane implements TemplateComposer {
return null; return null;
} }
private static final TreeItem getActionItem(final TreeItem item) { private static TreeItem getActionItem(final TreeItem item) {
final PageAction action = (PageAction) item.getData(ATTR_ACTIVITY_SELECTION); final PageAction action = (PageAction) item.getData(ATTR_ACTIVITY_SELECTION);
if (action == null && item.getItemCount() > 0) { if (action == null && item.getItemCount() > 0) {
final TreeItem firstChild = item.getItem(0); final TreeItem firstChild = item.getItem(0);
@ -556,11 +554,11 @@ public class ActivitiesPane implements TemplateComposer {
return item; return item;
} }
private static final PageAction getActivitySelection(final TreeItem item) { private static PageAction getActivitySelection(final TreeItem item) {
return (PageAction) item.getData(ATTR_ACTIVITY_SELECTION); return (PageAction) item.getData(ATTR_ACTIVITY_SELECTION);
} }
private final static void injectActivitySelection(final TreeItem item, final PageAction action) { private static void injectActivitySelection(final TreeItem item, final PageAction action) {
item.setData(ATTR_ACTIVITY_SELECTION, action); item.setData(ATTR_ACTIVITY_SELECTION, action);
} }

View file

@ -30,7 +30,7 @@ public enum ActivityDefinition implements Activity {
public final LocTextKey displayName; public final LocTextKey displayName;
private ActivityDefinition(final LocTextKey displayName) { ActivityDefinition(final LocTextKey displayName) {
this.displayName = displayName; this.displayName = displayName;
} }

View file

@ -94,7 +94,7 @@ public enum PageStateDefinitionImpl implements PageStateDefinition {
public final Class<? extends TemplateComposer> actionPaneComposer; public final Class<? extends TemplateComposer> actionPaneComposer;
public final Activity activityAnchor; public final Activity activityAnchor;
private PageStateDefinitionImpl( PageStateDefinitionImpl(
final Type type, final Type type,
final Class<? extends TemplateComposer> contentPaneComposer, final Class<? extends TemplateComposer> contentPaneComposer,
final Activity activityAnchor) { final Activity activityAnchor) {
@ -102,7 +102,7 @@ public enum PageStateDefinitionImpl implements PageStateDefinition {
this(type, contentPaneComposer, ActionPane.class, activityAnchor); this(type, contentPaneComposer, ActionPane.class, activityAnchor);
} }
private PageStateDefinitionImpl( PageStateDefinitionImpl(
final Type type, final Type type,
final Class<? extends TemplateComposer> contentPaneComposer, final Class<? extends TemplateComposer> contentPaneComposer,
final Class<? extends TemplateComposer> actionPaneComposer, final Class<? extends TemplateComposer> actionPaneComposer,

View file

@ -44,7 +44,6 @@ public class ThresholdListBuilder extends FieldBuilder<Collection<Threshold>> {
final Control titleLabel = createTitleLabel(builder.formParent, builder, this); final Control titleLabel = createTitleLabel(builder.formParent, builder, this);
if (builder.readonly || this.readonly) { if (builder.readonly || this.readonly) {
// No read-only view needed for this so far? // No read-only view needed for this so far?
return;
} else { } else {
final Composite fieldGrid = createFieldGrid(builder.formParent, this.spanInput); final Composite fieldGrid = createFieldGrid(builder.formParent, this.spanInput);

View file

@ -30,10 +30,10 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
public interface ExamConfigurationService { public interface ExamConfigurationService {
public static final String ATTRIBUTE_LABEL_LOC_TEXT_PREFIX = "sebserver.examconfig.props.label."; String ATTRIBUTE_LABEL_LOC_TEXT_PREFIX = "sebserver.examconfig.props.label.";
public static final String GROUP_LABEL_LOC_TEXT_PREFIX = "sebserver.examconfig.props.group."; String GROUP_LABEL_LOC_TEXT_PREFIX = "sebserver.examconfig.props.group.";
public static final String TOOL_TIP_SUFFIX = ".tooltip"; String TOOL_TIP_SUFFIX = ".tooltip";
public static final String TABLE_ROW_TITLE_SUFFIX = ".row.title"; String TABLE_ROW_TITLE_SUFFIX = ".row.title";
WidgetFactory getWidgetFactory(); WidgetFactory getWidgetFactory();

View file

@ -82,12 +82,11 @@ public abstract class AbstractTableFieldBuilder implements InputFieldBuilder {
} }
protected TableContext createTableContext(final ConfigurationAttribute attribute, final ViewContext viewContext) { protected TableContext createTableContext(final ConfigurationAttribute attribute, final ViewContext viewContext) {
final TableContext tableContext = new TableContext( return new TableContext(
this.inputFieldBuilderSupplier, this.inputFieldBuilderSupplier,
this.widgetFactory, this.widgetFactory,
attribute, attribute,
viewContext); viewContext);
return tableContext;
} }
protected void setSelectionListener(final Table table, final AbstractTableInputField tableField) { protected void setSelectionListener(final Table table, final AbstractTableInputField tableField) {
@ -115,7 +114,7 @@ public abstract class AbstractTableFieldBuilder implements InputFieldBuilder {
final Integer div = orientations final Integer div = orientations
.stream() .stream()
.map(o -> o.width) .map(o -> o.width)
.reduce(0, (acc, val) -> acc + val); .reduce(0, Integer::sum);
final int widthUnit = currentTableWidth / div; final int widthUnit = currentTableWidth / div;
for (int i = 0; i < columns.length - ((readonly) ? 0 : 2); i++) { for (int i = 0; i < columns.length - ((readonly) ? 0 : 2); i++) {
columns[i].setWidth(widthUnit * orientations.get(i).width); columns[i].setWidth(widthUnit * orientations.get(i).width);
@ -263,9 +262,8 @@ public abstract class AbstractTableFieldBuilder implements InputFieldBuilder {
values.clear(); values.clear();
final List<Integer> rows = new ArrayList<>(indexMapping.keySet()); final List<Integer> rows = new ArrayList<>(indexMapping.keySet());
rows.sort((i1, i2) -> i1.compareTo(i2)); rows.sort(Integer::compareTo);
rows rows
.stream()
.forEach(i -> { .forEach(i -> {
final Map<Long, TableValue> rowValues = indexMapping.get(i); final Map<Long, TableValue> rowValues = indexMapping.get(i);
values.add(rowValues); values.add(rowValues);

View file

@ -26,7 +26,7 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
interface CellFieldBuilderAdapter { interface CellFieldBuilderAdapter {
static CellFieldBuilderAdapter DUMMY_BUILDER_ADAPTER = new CellFieldBuilderAdapter() { CellFieldBuilderAdapter DUMMY_BUILDER_ADAPTER = new CellFieldBuilderAdapter() {
@Override @Override
public void createCell(final ViewGridBuilder builder) { public void createCell(final ViewGridBuilder builder) {
} }
@ -163,7 +163,7 @@ interface CellFieldBuilderAdapter {
}; };
} }
static class GroupCellFieldBuilderAdapter implements CellFieldBuilderAdapter { class GroupCellFieldBuilderAdapter implements CellFieldBuilderAdapter {
final Collection<Orientation> orientationsOfGroup; final Collection<Orientation> orientationsOfGroup;
@ -177,11 +177,11 @@ interface CellFieldBuilderAdapter {
for (final Orientation o : this.orientationsOfGroup) { for (final Orientation o : this.orientationsOfGroup) {
final int xpos = o.xPosition - ((o.title == TitleOrientation.LEFT) ? 1 : 0); final int xpos = o.xPosition - ((o.title == TitleOrientation.LEFT) ? 1 : 0);
this.x = (xpos < this.x) ? xpos : this.x; this.x = Math.min(xpos, this.x);
final int ypos = o.yPosition - ((o.title == TitleOrientation.TOP) ? 1 : 0); final int ypos = o.yPosition - ((o.title == TitleOrientation.TOP) ? 1 : 0);
this.y = (ypos < this.y) ? ypos : this.y; this.y = Math.min(ypos, this.y);
this.width = (this.width < o.xpos() + o.width()) ? o.xpos() + o.width() : this.width; this.width = Math.max(this.width, o.xpos() + o.width());
this.height = (this.height < o.ypos() + o.height()) ? o.ypos() + o.height() : this.height; this.height = Math.max(this.height, o.ypos() + o.height());
} }
this.width = this.width - this.x; this.width = this.width - this.x;
@ -191,7 +191,7 @@ interface CellFieldBuilderAdapter {
@Override @Override
public void createCell(final ViewGridBuilder builder) { public void createCell(final ViewGridBuilder builder) {
final WidgetFactory widgetFactory = builder.examConfigurationService.getWidgetFactory(); final WidgetFactory widgetFactory = builder.examConfigurationService.getWidgetFactory();
final Orientation o = this.orientationsOfGroup.stream().findFirst().get(); final Orientation o = this.orientationsOfGroup.stream().findFirst().orElse(null);
final LocTextKey groupLabelKey = new LocTextKey( final LocTextKey groupLabelKey = new LocTextKey(
ExamConfigurationService.GROUP_LABEL_LOC_TEXT_PREFIX + ExamConfigurationService.GROUP_LABEL_LOC_TEXT_PREFIX +
o.groupId, o.groupId,

View file

@ -112,7 +112,7 @@ public class CheckBoxBuilder implements InputFieldBuilder {
@Override @Override
protected void setValueToControl(final String value) { protected void setValueToControl(final String value) {
this.control.setSelection(Boolean.valueOf(this.initValue)); this.control.setSelection(Boolean.parseBoolean(this.initValue));
} }
@Override @Override

View file

@ -214,9 +214,9 @@ public class CompositeTableFieldBuilder extends AbstractTableFieldBuilder {
} else { } else {
dialog.open( dialog.open(
new LocTextKey(ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + row), new LocTextKey(ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + row),
(Consumer<Map<Long, TableValue>>) rowVals -> applyFormValues( (Consumer<Map<Long, TableValue>>) _rowValues -> applyFormValues(
this.values, this.values,
rowVals, _rowValues,
selectionIndex), selectionIndex),
() -> this.tableContext.getValueChangeListener() () -> this.tableContext.getValueChangeListener()
.tableChanged(extractTableValue(this.values)), .tableChanged(extractTableValue(this.values)),

View file

@ -10,6 +10,7 @@ package ch.ethz.seb.sebserver.gui.service.examconfig.impl;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -106,12 +107,10 @@ public class ExamConfigurationServiceImpl implements ExamConfigurationService {
@Override @Override
public Result<AttributeMapping> getAttributes(final Long templateId) { public Result<AttributeMapping> getAttributes(final Long templateId) {
return Result.tryCatch(() -> { return Result.tryCatch(() -> new AttributeMapping(
return new AttributeMapping(
templateId, templateId,
getAttributes(), getAttributes(),
getOrientations(templateId)); getOrientations(templateId)));
});
} }
@Override @Override
@ -124,12 +123,10 @@ public class ExamConfigurationServiceImpl implements ExamConfigurationService {
orientations.add(defaultOrientation); orientations.add(defaultOrientation);
} }
return Result.tryCatch(() -> { return Result.tryCatch(() -> new AttributeMapping(
return new AttributeMapping(
attribute.templateId, attribute.templateId,
getAttributes(), getAttributes(),
orientations); orientations));
});
} }
private List<Orientation> getOrientations(final Long templateId) { private List<Orientation> getOrientations(final Long templateId) {
@ -168,7 +165,7 @@ public class ExamConfigurationServiceImpl implements ExamConfigurationService {
.call() .call()
.getOrThrow() .getOrThrow()
.stream() .stream()
.sorted((v1, v2) -> v1.position.compareTo(v2.position)) .sorted(Comparator.comparing(v -> v.position))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@ -251,12 +248,10 @@ public class ExamConfigurationServiceImpl implements ExamConfigurationService {
final EntityKey parentEntityKey = action.pageContext().getParentEntityKey(); final EntityKey parentEntityKey = action.pageContext().getParentEntityKey();
final Set<EntityKey> selection = action.getMultiSelection(); final Set<EntityKey> selection = action.getMultiSelection();
if (selection != null && !selection.isEmpty()) { if (selection != null && !selection.isEmpty()) {
selection.stream().forEach(entityKey -> { selection.forEach(entityKey -> callTemplateAction(
callTemplateAction(
ResetTemplateValues.class, ResetTemplateValues.class,
parentEntityKey.modelId, parentEntityKey.modelId,
entityKey.modelId); entityKey.modelId));
});
} else { } else {
final EntityKey entityKey = action.getEntityKey(); final EntityKey entityKey = action.getEntityKey();
callTemplateAction( callTemplateAction(
@ -273,12 +268,10 @@ public class ExamConfigurationServiceImpl implements ExamConfigurationService {
final EntityKey parentEntityKey = action.pageContext().getParentEntityKey(); final EntityKey parentEntityKey = action.pageContext().getParentEntityKey();
final Set<EntityKey> selection = action.getMultiSelection(); final Set<EntityKey> selection = action.getMultiSelection();
if (selection != null && !selection.isEmpty()) { if (selection != null && !selection.isEmpty()) {
selection.stream().forEach(entityKey -> { selection.forEach(entityKey -> callTemplateAction(
callTemplateAction(
RemoveOrientation.class, RemoveOrientation.class,
parentEntityKey.modelId, parentEntityKey.modelId,
entityKey.modelId); entityKey.modelId));
});
} else { } else {
final EntityKey entityKey = action.getEntityKey(); final EntityKey entityKey = action.getEntityKey();
callTemplateAction( callTemplateAction(
@ -295,12 +288,10 @@ public class ExamConfigurationServiceImpl implements ExamConfigurationService {
final EntityKey parentEntityKey = action.pageContext().getParentEntityKey(); final EntityKey parentEntityKey = action.pageContext().getParentEntityKey();
final Set<EntityKey> selection = action.getMultiSelection(); final Set<EntityKey> selection = action.getMultiSelection();
if (selection != null && !selection.isEmpty()) { if (selection != null && !selection.isEmpty()) {
selection.stream().forEach(entityKey -> { selection.forEach(entityKey -> callTemplateAction(
callTemplateAction(
AttachDefaultOrientation.class, AttachDefaultOrientation.class,
parentEntityKey.modelId, parentEntityKey.modelId,
entityKey.modelId); entityKey.modelId));
});
} else { } else {
final EntityKey entityKey = action.getEntityKey(); final EntityKey entityKey = action.getEntityKey();
callTemplateAction( callTemplateAction(

View file

@ -63,10 +63,9 @@ public class InlineTableFieldBuilder implements InputFieldBuilder {
final Map<String, String> defaultValues = StringUtils.isBlank(attribute.defaultValue) final Map<String, String> defaultValues = StringUtils.isBlank(attribute.defaultValue)
? Collections.emptyMap() ? Collections.emptyMap()
: Arrays.asList(StringUtils.split( : Arrays.stream(StringUtils.split(
attribute.defaultValue, attribute.defaultValue,
Constants.EMBEDDED_LIST_SEPARATOR)) Constants.EMBEDDED_LIST_SEPARATOR))
.stream()
.map(valueString -> StringUtils.split( .map(valueString -> StringUtils.split(
valueString, valueString,
Constants.FORM_URL_ENCODED_NAME_VALUE_SEPARATOR)) Constants.FORM_URL_ENCODED_NAME_VALUE_SEPARATOR))
@ -74,10 +73,9 @@ public class InlineTableFieldBuilder implements InputFieldBuilder {
valueMap -> valueMap[0], valueMap -> valueMap[0],
valueMap -> (valueMap.length > 1) ? valueMap[1] : StringUtils.EMPTY)); valueMap -> (valueMap.length > 1) ? valueMap[1] : StringUtils.EMPTY));
final List<ColumnDef> columns = Arrays.asList(StringUtils.split( final List<ColumnDef> columns = Arrays.stream(StringUtils.split(
attribute.getResources(), attribute.getResources(),
Constants.EMBEDDED_LIST_SEPARATOR)) Constants.EMBEDDED_LIST_SEPARATOR))
.stream()
.map(columnString -> ColumnDef.fromString(columnString, defaultValues)) .map(columnString -> ColumnDef.fromString(columnString, defaultValues))
.collect(Collectors.toList()); .collect(Collectors.toList());

View file

@ -29,7 +29,6 @@ public class InputFieldBuilderSupplier {
protected InputFieldBuilderSupplier(final Collection<InputFieldBuilder> inputFieldBuilder) { protected InputFieldBuilderSupplier(final Collection<InputFieldBuilder> inputFieldBuilder) {
this.inputFieldBuilder = inputFieldBuilder; this.inputFieldBuilder = inputFieldBuilder;
inputFieldBuilder inputFieldBuilder
.stream()
.forEach(builder -> builder.init(this)); .forEach(builder -> builder.init(this));
} }

View file

@ -43,7 +43,7 @@ public class LabelBuilder implements InputFieldBuilder {
} }
return attribute.type == AttributeType.LABEL; return attribute.type == AttributeType.LABEL;
}; }
@Override @Override
public InputField createInputField( public InputField createInputField(

View file

@ -104,7 +104,7 @@ public class PasswordFieldBuilder implements InputFieldBuilder {
final CharSequence pwd = passwordInput.getValue(); final CharSequence pwd = passwordInput.getValue();
final CharSequence confirm = confirmInput.getValue(); final CharSequence confirm = confirmInput.getValue();
if (passwordInputField.initValue != null && passwordInputField.initValue.equals(pwd)) { if (passwordInputField.initValue != null && passwordInputField.initValue.contentEquals(pwd)) {
return; return;
} }

View file

@ -54,10 +54,9 @@ public abstract class SelectionFieldBuilder {
attribute) + "." attribute) + "."
: ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + attribute.name + "."; : ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + attribute.name + ".";
return Arrays.asList(StringUtils.split( return Arrays.stream(StringUtils.split(
attribute.resources, attribute.resources,
Constants.LIST_SEPARATOR)) Constants.LIST_SEPARATOR))
.stream()
.map(value -> { .map(value -> {
final String key = prefix + value + ((toolTipResources) final String key = prefix + value + ((toolTipResources)
? ExamConfigurationService.TOOL_TIP_SUFFIX ? ExamConfigurationService.TOOL_TIP_SUFFIX

View file

@ -102,9 +102,7 @@ public class TableFieldBuilder extends AbstractTableFieldBuilder {
column.setResizable(false); column.setResizable(false);
column.setMoveable(false); column.setMoveable(false);
column.addListener(SWT.Selection, event -> { column.addListener(SWT.Selection, event -> tableField.addRow());
tableField.addRow();
});
column = new TableColumn(table, SWT.NONE); column = new TableColumn(table, SWT.NONE);
column.setImage(ImageIcon.REMOVE_BOX_WHITE.getImage(parent.getDisplay())); column.setImage(ImageIcon.REMOVE_BOX_WHITE.getImage(parent.getDisplay()));
@ -212,9 +210,9 @@ public class TableFieldBuilder extends AbstractTableFieldBuilder {
ExamConfigurationService.getTablePopupTitleKey( ExamConfigurationService.getTablePopupTitleKey(
this.attribute, this.attribute,
this.tableContext.getViewContext().i18nSupport), this.tableContext.getViewContext().i18nSupport),
(Consumer<Map<Long, TableValue>>) rowVals -> applyFormValues( (Consumer<Map<Long, TableValue>>) _rowValues -> applyFormValues(
this.values, this.values,
rowVals, _rowValues,
selectionIndex), selectionIndex),
() -> this.tableContext.getValueChangeListener() () -> this.tableContext.getValueChangeListener()
.tableChanged(extractTableValue(this.values)), .tableChanged(extractTableValue(this.values)),

View file

@ -100,9 +100,7 @@ public class TableRowFormBuilder implements ModalInputDialogComposer<Map<Long, T
} }
// when the pop-up gets closed we have to remove the input fields from the view context // when the pop-up gets closed we have to remove the input fields from the view context
grid.addDisposeListener(event -> { grid.addDisposeListener(event -> this.tableContext.flushInputFields(this.rowValues.keySet()));
this.tableContext.flushInputFields(this.rowValues.keySet());
});
return () -> inputFields.stream() return () -> inputFields.stream()
.map(field -> (field.hasError()) .map(field -> (field.hasError())

View file

@ -226,7 +226,6 @@ public final class ViewContext {
void setValuesToInputFields(final Collection<ConfigurationValue> values) { void setValuesToInputFields(final Collection<ConfigurationValue> values) {
this.inputFieldMapping this.inputFieldMapping
.values() .values()
.stream()
.forEach(field -> { .forEach(field -> {
final ConfigurationValue initValue = field.initValue(values); final ConfigurationValue initValue = field.initValue(values);
if (initValue != null) { if (initValue != null) {
@ -243,8 +242,7 @@ public final class ViewContext {
return; return;
} }
values.stream() values.forEach(this.inputFieldMapping::remove);
.forEach(attrId -> this.inputFieldMapping.remove(attrId));
} }
} }

View file

@ -200,7 +200,7 @@ public class ViewGridBuilder {
} }
private String gridToString() { private String gridToString() {
final StringBuffer sb = new StringBuffer(); final StringBuilder sb = new StringBuilder();
for (int i = 0; i < this.grid.length; i++) { for (int i = 0; i < this.grid.length; i++) {
if (sb.length() > 0) { if (sb.length() > 0) {
sb.append(",\n"); sb.append(",\n");

View file

@ -51,10 +51,6 @@ public class BrowserViewModeRule implements ValueChangeRule {
context.enableGroup(KEY_MAIN_WINDOW_GROUP); context.enableGroup(KEY_MAIN_WINDOW_GROUP);
switch (Integer.parseInt(value.value)) { switch (Integer.parseInt(value.value)) {
case 0: {
context.disable(KEY_TOUCH_EXIT);
break;
}
case 1: { case 1: {
context.disable(KEY_TOUCH_EXIT); context.disable(KEY_TOUCH_EXIT);
context.disableGroup(KEY_MAIN_WINDOW_GROUP); context.disableGroup(KEY_MAIN_WINDOW_GROUP);

View file

@ -17,10 +17,10 @@ import ch.ethz.seb.sebserver.gbl.util.Utils;
public interface I18nSupport { public interface I18nSupport {
public static final String SUPPORTED_LANGUAGES_KEY = "sebserver.gui.supported.languages"; String SUPPORTED_LANGUAGES_KEY = "sebserver.gui.supported.languages";
public static final String MULTILINGUAL_KEY = "sebserver.gui.multilingual"; String MULTILINGUAL_KEY = "sebserver.gui.multilingual";
public static final String FORMAL_LOCALE_KEY = "sebserver.gui.date.displayformat"; String FORMAL_LOCALE_KEY = "sebserver.gui.date.displayformat";
public static final String ATTR_CURRENT_SESSION_LOCALE = "CURRENT_SESSION_LOCALE"; String ATTR_CURRENT_SESSION_LOCALE = "CURRENT_SESSION_LOCALE";
/** Get all supported languages as a collection of Locale /** Get all supported languages as a collection of Locale
* *
@ -40,7 +40,7 @@ public interface I18nSupport {
Locale getUsersFormatLocale(); Locale getUsersFormatLocale();
/** Format a DateTime to a text format to display. /** Format a DateTime to a text format to display.
* This uses the date-format defined by either the attribute 'sebserver.gui.date.displayformat' * This uses the date-format defined by either the attribute 'sebserver.gui.date.display format'
* or the Constants.DEFAULT_DISPLAY_DATE_FORMAT * or the Constants.DEFAULT_DISPLAY_DATE_FORMAT
* *
* Adds time-zone offset information if the currents user time-zone is different form UTC * Adds time-zone offset information if the currents user time-zone is different form UTC
@ -50,7 +50,7 @@ public interface I18nSupport {
String formatDisplayDate(DateTime date); String formatDisplayDate(DateTime date);
/** Format a DateTime to a text format to display with additional time zone name at the end. /** Format a DateTime to a text format to display with additional time zone name at the end.
* This uses the date-format defined by either the attribute 'sebserver.gui.date.displayformat' * This uses the date-format defined by either the attribute 'sebserver.gui.date.display format'
* or the Constants.DEFAULT_DISPLAY_DATE_FORMAT * or the Constants.DEFAULT_DISPLAY_DATE_FORMAT
* *
* Adds time-zone offset information if the currents user time-zone is different form UTC * Adds time-zone offset information if the currents user time-zone is different form UTC
@ -62,19 +62,19 @@ public interface I18nSupport {
} }
/** Format a time-stamp (milliseconds) to a text format to display. /** Format a time-stamp (milliseconds) to a text format to display.
* This uses the date-format defined by either the attribute 'sebserver.gui.date.displayformat' * This uses the date-format defined by either the attribute 'sebserver.gui.date.display format'
* or the Constants.DEFAULT_DISPLAY_DATE_FORMAT * or the Constants.DEFAULT_DISPLAY_DATE_FORMAT
* *
* Adds time-zone information if the currents user time-zone is different form UTC * Adds time-zone information if the currents user time-zone is different form UTC
* *
* @param date the DateTime instance * @param timestamp the unix-timestamp in milliseconds
* @return date formatted date String to display */ * @return date formatted date String to display */
default String formatDisplayDate(final Long timestamp) { default String formatDisplayDate(final Long timestamp) {
return formatDisplayDate(Utils.toDateTimeUTC(timestamp)); return formatDisplayDate(Utils.toDateTimeUTC(timestamp));
} }
/** Format a DateTime to a text format to display. /** Format a DateTime to a text format to display.
* This uses the date-format defined by either the attribute 'sebserver.gui.datetime.displayformat' * This uses the date-format defined by either the attribute 'sebserver.gui.datetime.display format'
* or the Constants.DEFAULT_DISPLAY_DATE_TIME_FORMAT * or the Constants.DEFAULT_DISPLAY_DATE_TIME_FORMAT
* *
* Adds time-zone information if the currents user time-zone is different form UTC * Adds time-zone information if the currents user time-zone is different form UTC
@ -84,19 +84,19 @@ public interface I18nSupport {
String formatDisplayDateTime(DateTime date); String formatDisplayDateTime(DateTime date);
/** Format a time-stamp (milliseconds) to a text format to display. /** Format a time-stamp (milliseconds) to a text format to display.
* This uses the date-format defined by either the attribute 'sebserver.gui.datetime.displayformat' * This uses the date-format defined by either the attribute 'sebserver.gui.datetime.display format'
* or the Constants.DEFAULT_DISPLAY_DATE_TIME_FORMAT * or the Constants.DEFAULT_DISPLAY_DATE_TIME_FORMAT
* *
* Adds time-zone information if the currents user time-zone is different form UTC * Adds time-zone information if the currents user time-zone is different form UTC
* *
* @param date the DateTime instance * @param timestamp the unix-timestamp in milliseconds
* @return date formatted date time String to display */ * @return date formatted date time String to display */
default String formatDisplayDateTime(final Long timestamp) { default String formatDisplayDateTime(final Long timestamp) {
return formatDisplayDateTime(Utils.toDateTimeUTC(timestamp)); return formatDisplayDateTime(Utils.toDateTimeUTC(timestamp));
} }
/** Format a DateTime to a text format to display. /** Format a DateTime to a text format to display.
* This uses the date-format defined by either the attribute 'sebserver.gui.time.displayformat' * This uses the date-format defined by either the attribute 'sebserver.gui.time.display format'
* or the Constants.DEFAULT_DISPLAY_TIME_FORMAT * or the Constants.DEFAULT_DISPLAY_TIME_FORMAT
* *
* Adds time-zone information if the currents user time-zone is different form UTC * Adds time-zone information if the currents user time-zone is different form UTC
@ -106,12 +106,12 @@ public interface I18nSupport {
String formatDisplayTime(DateTime date); String formatDisplayTime(DateTime date);
/** Format a time-stamp (milliseconds) to a text format to display. /** Format a time-stamp (milliseconds) to a text format to display.
* This uses the date-format defined by either the attribute 'sebserver.gui.time.displayformat' * This uses the date-format defined by either the attribute 'sebserver.gui.time.display format'
* or the Constants.DEFAULT_DISPLAY_TIME_FORMAT * or the Constants.DEFAULT_DISPLAY_TIME_FORMAT
* *
* Adds time-zone information if the currents user time-zone is different form UTC * Adds time-zone information if the currents user time-zone is different form UTC
* *
* @param date the DateTime instance * @param timestamp the unix-timestamp in milliseconds
* @return date formatted time String to display */ * @return date formatted time String to display */
default String formatDisplayTime(final Long timestamp) { default String formatDisplayTime(final Long timestamp) {
return formatDisplayTime(Utils.toDateTimeUTC(timestamp)); return formatDisplayTime(Utils.toDateTimeUTC(timestamp));

View file

@ -39,34 +39,116 @@ public interface PolyglotPageService {
* @param locale the Locale to set */ * @param locale the Locale to set */
void setPageLocale(Composite root, Locale locale); void setPageLocale(Composite root, Locale locale);
/** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param imageUpload the Control instance
* @param locTextKey the localized text key to inject
*/
void injectI18n(ImageUploadSelection imageUpload, LocTextKey locTextKey); void injectI18n(ImageUploadSelection imageUpload, LocTextKey locTextKey);
/** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param label the Control instance
* @param locTextKey the localized text key to inject
*/
void injectI18n(Label label, LocTextKey locTextKey); void injectI18n(Label label, LocTextKey locTextKey);
/** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param label the Control instance
* @param locTextKey the localized text key to inject
* @param locToolTipKey the localized text key for the tooltip to inject
*/
void injectI18n(Label label, LocTextKey locTextKey, LocTextKey locToolTipKey); void injectI18n(Label label, LocTextKey locTextKey, LocTextKey locToolTipKey);
/** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param group the Control instance
* @param locTextKey the localized text key to inject
* @param locTooltipKey the localized text key for the tooltip to inject
*/
void injectI18n(Group group, LocTextKey locTextKey, LocTextKey locTooltipKey); void injectI18n(Group group, LocTextKey locTextKey, LocTextKey locTooltipKey);
/** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param button the Control instance
* @param locTextKey the localized text key to inject
*/
void injectI18n(Button button, LocTextKey locTextKey); void injectI18n(Button button, LocTextKey locTextKey);
/** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param button the Control instance
* @param locTextKey the localized text key to inject
* @param locToolTipKey the localized text key for the tooltip to inject
*/
void injectI18n(Button button, LocTextKey locTextKey, LocTextKey locToolTipKey); void injectI18n(Button button, LocTextKey locTextKey, LocTextKey locToolTipKey);
/** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param tree the Control instance
*/
void injectI18n(Tree tree); void injectI18n(Tree tree);
/** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param treeItem the Control instance
* @param locTextKey the localized text key to inject
*/
void injectI18n(TreeItem treeItem, LocTextKey locTextKey); void injectI18n(TreeItem treeItem, LocTextKey locTextKey);
/** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param table the Control instance
*/
void injectI18n(Table table); void injectI18n(Table table);
/** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param tabFolder the Control instance
*/
void injectI18n(TabFolder tabFolder); void injectI18n(TabFolder tabFolder);
/** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param tableColumn the Control instance
* @param locTextKey the localized text key to inject
* @param locTooltipKey the localized text key for the tooltip to inject
*/
void injectI18n(TableColumn tableColumn, LocTextKey locTextKey, LocTextKey locTooltipKey); void injectI18n(TableColumn tableColumn, LocTextKey locTextKey, LocTextKey locTooltipKey);
void injectI18n(TableItem tableItem, LocTextKey... locTextKey); /** Used to inject a localised text within the given Control (Widget) that automatically gets changed on language
* change.
*
* @param tabItem the Control instance
* @param locTextKey the localized text key to inject
* @param locTooltipKey the localized text key for the tooltip to inject
*/
void injectI18n(TabItem tabItem, LocTextKey locTextKey, LocTextKey locTooltipKey); void injectI18n(TabItem tabItem, LocTextKey locTextKey, LocTextKey locTooltipKey);
/** Used to inject a localised tooltip text within the given Control (Widget) that automatically gets changed on
* language change.
*
* @param control the Control instance
* @param locTooltipKey the localized text key for the tooltip to inject
*/
void injectI18nTooltip(Control control, LocTextKey locTooltipKey); void injectI18nTooltip(Control control, LocTextKey locTooltipKey);
/** Used to create the page language selector if needed
*
* @param composerCtx the PageContext
*/
void createLanguageSelector(PageContext composerCtx); void createLanguageSelector(PageContext composerCtx);
} }

View file

@ -56,11 +56,11 @@ public class I18nSupportImpl implements I18nSupport {
this.currentUser = currentUser; this.currentUser = currentUser;
this.messageSource = messageSource; this.messageSource = messageSource;
final String defaultForamtLocaleString = environment.getProperty( final String defaultFormatLocaleString = environment.getProperty(
FORMAL_LOCALE_KEY, FORMAL_LOCALE_KEY,
Constants.DEFAULT_LANG_CODE); Constants.DEFAULT_LANG_CODE);
this.defaultFormatLocale = Locale.forLanguageTag(defaultForamtLocaleString); this.defaultFormatLocale = Locale.forLanguageTag(defaultFormatLocaleString);
final boolean multilingual = BooleanUtils.toBoolean(environment.getProperty( final boolean multilingual = BooleanUtils.toBoolean(environment.getProperty(
MULTILINGUAL_KEY, MULTILINGUAL_KEY,
@ -71,9 +71,8 @@ public class I18nSupportImpl implements I18nSupport {
Locale.ENGLISH.getLanguage()); Locale.ENGLISH.getLanguage());
this.supportedLanguages = Utils.immutableCollectionOf( this.supportedLanguages = Utils.immutableCollectionOf(
Arrays.asList(StringUtils.split(languagesString, Constants.LIST_SEPARATOR)) Arrays.stream(StringUtils.split(languagesString, Constants.LIST_SEPARATOR))
.stream() .map(Locale::forLanguageTag)
.map(s -> Locale.forLanguageTag(s))
.collect(Collectors.toList())); .collect(Collectors.toList()));
} else { } else {

View file

@ -165,18 +165,6 @@ public final class PolyglotPageServiceImpl implements PolyglotPageService {
} }
} }
@Override
public void injectI18n(final TableItem tableItem, final LocTextKey... locTextKey) {
if (locTextKey == null) {
return;
}
tableItem.setData(POLYGLOT_ITEM_TEXT_DATA_KEY, locTextKey);
for (int i = 0; i < locTextKey.length; i++) {
tableItem.setText(i, this.i18nSupport.getText(locTextKey[i]));
}
}
@Override @Override
public void injectI18n(final TabItem tabItem, final LocTextKey locTextKey, final LocTextKey locTooltipKey) { public void injectI18n(final TabItem tabItem, final LocTextKey locTextKey, final LocTextKey locTooltipKey) {
tabItem.setData(POLYGLOT_ITEM_TEXT_DATA_KEY, locTextKey); tabItem.setData(POLYGLOT_ITEM_TEXT_DATA_KEY, locTextKey);

View file

@ -111,7 +111,7 @@ public class ComposerServiceImpl implements ComposerService {
} }
if (!this.composer.containsKey(name)) { if (!this.composer.containsKey(name)) {
log.error("No TemplateComposer with name: " + name + " found. Check Spring confiuration and beans"); log.error("No TemplateComposer with name: " + name + " found. Check Spring configuration and beans");
return; return;
} }
@ -126,7 +126,7 @@ public class ComposerServiceImpl implements ComposerService {
PageService.updateScrolledComposite(pageContext.getParent()); PageService.updateScrolledComposite(pageContext.getParent());
} catch (final IllegalUserSessionStateException e) { } catch (final IllegalUserSessionStateException e) {
log.warn("Illegal user session state detected... ceanup user session and forward to login page."); log.warn("Illegal user session state detected... cleanup user session and forward to login page.");
pageContext.forwardToLoginPage(); pageContext.forwardToLoginPage();
final MessageBox logoutSuccess = new Message( final MessageBox logoutSuccess = new Message(
pageContext.getShell(), pageContext.getShell(),