diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamForm.java index 46e7c2bc..90c3a20d 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamForm.java @@ -62,6 +62,16 @@ public class ExamForm implements TemplateComposer { private static final Logger log = LoggerFactory.getLogger(ExamForm.class); + private static final LocTextKey FORM_SUPPORTER_TEXT_KEY = new LocTextKey("sebserver.exam.form.supporter"); + private static final LocTextKey FORM_STATUS_TEXT_KEY = new LocTextKey("sebserver.exam.form.status"); + private static final LocTextKey FORM_TYPE_TEXT_KEY = new LocTextKey("sebserver.exam.form.type"); + private static final LocTextKey FORM_ENDTIME_TEXT_KEY = new LocTextKey("sebserver.exam.form.endtime"); + private static final LocTextKey FORM_STARTTIME_TEXT_KEY = new LocTextKey("sebserver.exam.form.starttime"); + private static final LocTextKey FORM_DESCRIPTION_TEXT_KEY = new LocTextKey("sebserver.exam.form.description"); + private static final LocTextKey FORM_NAME_TEXT_KEY = new LocTextKey("sebserver.exam.form.name"); + private static final LocTextKey FORM_QUIZID_TEXT_KEY = new LocTextKey("sebserver.exam.form.quizid"); + private static final LocTextKey FORM_LMSSETUP_TEXT_KEY = new LocTextKey("sebserver.exam.form.lmssetup"); + private final PageService pageService; private final ResourceService resourceService; @@ -155,49 +165,49 @@ public class ExamForm implements TemplateComposer { .addField(FormBuilder.singleSelection( Domain.EXAM.ATTR_LMS_SETUP_ID, - "sebserver.exam.form.lmssetup", + FORM_LMSSETUP_TEXT_KEY, String.valueOf(exam.lmsSetupId), this.resourceService::lmsSetupResource) .readonly(true)) .addField(FormBuilder.text( Domain.EXAM.ATTR_EXTERNAL_ID, - "sebserver.exam.form.quizid", + FORM_QUIZID_TEXT_KEY, exam.externalId) .readonly(true)) .addField(FormBuilder.text( QuizData.QUIZ_ATTR_NAME, - "sebserver.exam.form.name", + FORM_NAME_TEXT_KEY, exam.name) .readonly(true)) .addField(FormBuilder.text( QuizData.QUIZ_ATTR_DESCRIPTION, - "sebserver.exam.form.description", + FORM_DESCRIPTION_TEXT_KEY, exam.description) .asArea() .readonly(true)) .addField(FormBuilder.text( QuizData.QUIZ_ATTR_START_TIME, - "sebserver.exam.form.starttime", + FORM_STARTTIME_TEXT_KEY, i18nSupport.formatDisplayDate(exam.startTime)) .readonly(true)) .addField(FormBuilder.text( QuizData.QUIZ_ATTR_END_TIME, - "sebserver.exam.form.endtime", + FORM_ENDTIME_TEXT_KEY, i18nSupport.formatDisplayDate(exam.endTime)) .readonly(true)) .addField(FormBuilder.singleSelection( Domain.EXAM.ATTR_TYPE, - "sebserver.exam.form.type", + FORM_TYPE_TEXT_KEY, String.valueOf(exam.type), this.resourceService::examTypeResources)) .addField(FormBuilder.text( Exam.ATTR_STATUS, - "sebserver.exam.form.status", + FORM_STATUS_TEXT_KEY, i18nSupport.getText(new LocTextKey("sebserver.exam.status." + examStatus.name()))) .readonly(true)) .addField(FormBuilder.multiComboSelection( Domain.EXAM.ATTR_SUPPORTER, - "sebserver.exam.form.supporter", + FORM_SUPPORTER_TEXT_KEY, StringUtils.join(exam.supporter, Constants.LIST_SEPARATOR_CHAR), this.resourceService::examSupporterResources)) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/IndicatorForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/IndicatorForm.java index 53bc0133..b708255b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/IndicatorForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/IndicatorForm.java @@ -42,6 +42,17 @@ public class IndicatorForm implements TemplateComposer { private static final Logger log = LoggerFactory.getLogger(IndicatorForm.class); + private static final LocTextKey FORM_THRESHOLDS_TEXT_KEY = + new LocTextKey("sebserver.exam.indicator.form.thresholds"); + private static final LocTextKey FORM_COLOR_TEXT_KEY = + new LocTextKey("sebserver.exam.indicator.form.color"); + private static final LocTextKey FORM_TYPE_TEXT_KEY = + new LocTextKey("sebserver.exam.indicator.form.type"); + private static final LocTextKey FORM_NAME_TEXT_KEY = + new LocTextKey("sebserver.exam.indicator.form.name"); + private static final LocTextKey FORM_EXAM_TEXT_KEY = + new LocTextKey("sebserver.exam.indicator.form.exam"); + private final PageService pageService; private final ResourceService resourceService; @@ -110,25 +121,25 @@ public class IndicatorForm implements TemplateComposer { parentEntityKey.getModelId()) .addField(FormBuilder.text( "examName", - "sebserver.exam.indicator.form.exam", + FORM_EXAM_TEXT_KEY, exam.name) .readonly(true)) .addField(FormBuilder.text( Domain.INDICATOR.ATTR_NAME, - "sebserver.exam.indicator.form.name", + FORM_NAME_TEXT_KEY, indicator.name)) .addField(FormBuilder.singleSelection( Domain.INDICATOR.ATTR_TYPE, - "sebserver.exam.indicator.form.type", + FORM_TYPE_TEXT_KEY, (indicator.type != null) ? indicator.type.name() : null, this.resourceService::indicatorTypeResources)) .addField(FormBuilder.colorSelection( Domain.INDICATOR.ATTR_COLOR, - "sebserver.exam.indicator.form.color", + FORM_COLOR_TEXT_KEY, indicator.defaultColor)) .addField(FormBuilder.thresholdList( Domain.THRESHOLD.REFERENCE_NAME, - "sebserver.exam.indicator.form.thresholds", + FORM_THRESHOLDS_TEXT_KEY, indicator.getThresholds())) .buildFor((isNew) ? restService.getRestCall(NewIndicator.class) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/InstitutionForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/InstitutionForm.java index 2106b82a..8dc09dc9 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/InstitutionForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/InstitutionForm.java @@ -47,6 +47,13 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; @GuiProfile public class InstitutionForm implements TemplateComposer { + private static final LocTextKey FORM_LOGO_IMAGE_TEXT_KEY = + new LocTextKey("sebserver.institution.form.logoImage"); + private static final LocTextKey FORM_URL_SUFFIX_TEXT_KEY = + new LocTextKey("sebserver.institution.form.urlSuffix"); + private static final LocTextKey FORM_NAME_TEXT_KEY = + new LocTextKey("sebserver.institution.form.name"); + private static final Logger log = LoggerFactory.getLogger(InstitutionForm.class); private final PageService pageService; @@ -123,15 +130,15 @@ public class InstitutionForm implements TemplateComposer { institution.getModelId()) .addField(FormBuilder.text( Domain.INSTITUTION.ATTR_NAME, - "sebserver.institution.form.name", + FORM_NAME_TEXT_KEY, institution.name)) .addField(FormBuilder.text( Domain.INSTITUTION.ATTR_URL_SUFFIX, - "sebserver.institution.form.urlSuffix", + FORM_URL_SUFFIX_TEXT_KEY, institution.urlSuffix)) .addField(FormBuilder.imageUpload( Domain.INSTITUTION.ATTR_LOGO_IMAGE, - "sebserver.institution.form.logoImage", + FORM_LOGO_IMAGE_TEXT_KEY, institution.logoImage)) .buildFor((isNew) ? this.restService.getRestCall(NewInstitution.class) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java index 823102e3..94b27843 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java @@ -60,6 +60,19 @@ public class LmsSetupForm implements TemplateComposer { private static final Logger log = LoggerFactory.getLogger(LmsSetupForm.class); + private static final LocTextKey FORM_SECRET_LMS_TEXT_KEY = + new LocTextKey("sebserver.lmssetup.form.secret.lms"); + private static final LocTextKey FORM_CLIENTNAME_LMS_TEXT_KEY = + new LocTextKey("sebserver.lmssetup.form.clientname.lms"); + private static final LocTextKey FORM_URL_TEXT_KEY = + new LocTextKey("sebserver.lmssetup.form.url"); + private static final LocTextKey FORM_TYPE_TEXT_KEY = + new LocTextKey("sebserver.lmssetup.form.type"); + private static final LocTextKey FORM_NAME_TEXT_KEY = + new LocTextKey("sebserver.lmssetup.form.name"); + private static final LocTextKey FORM_INSTITUTION_TEXT_KEY = + new LocTextKey("sebserver.lmssetup.form.institution"); + private final PageService pageService; private final ResourceService resourceService; @@ -143,31 +156,31 @@ public class LmsSetupForm implements TemplateComposer { isSEBAdmin, () -> FormBuilder.singleSelection( Domain.LMS_SETUP.ATTR_INSTITUTION_ID, - "sebserver.lmssetup.form.institution", + FORM_INSTITUTION_TEXT_KEY, String.valueOf(lmsSetup.getInstitutionId()), () -> this.resourceService.institutionResource()) .readonly(true)) .addField(FormBuilder.text( Domain.LMS_SETUP.ATTR_NAME, - "sebserver.lmssetup.form.name", + FORM_NAME_TEXT_KEY, lmsSetup.getName())) .addField(FormBuilder.singleSelection( Domain.LMS_SETUP.ATTR_LMS_TYPE, - "sebserver.lmssetup.form.type", + FORM_TYPE_TEXT_KEY, (lmsType != null) ? lmsType.name() : null, this.resourceService::lmsTypeResources) .readonlyIf(isNotNew)) .addField(FormBuilder.text( Domain.LMS_SETUP.ATTR_LMS_URL, - "sebserver.lmssetup.form.url", + FORM_URL_TEXT_KEY, lmsSetup.getLmsApiUrl())) .addField(FormBuilder.text( Domain.LMS_SETUP.ATTR_LMS_CLIENTNAME, - "sebserver.lmssetup.form.clientname.lms", + FORM_CLIENTNAME_LMS_TEXT_KEY, lmsSetup.getLmsAuthName())) .addField(FormBuilder.text( Domain.LMS_SETUP.ATTR_LMS_CLIENTSECRET, - "sebserver.lmssetup.form.secret.lms") + FORM_SECRET_LMS_TEXT_KEY) .asPasswordField()) .buildFor((entityKey == null) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/QuizDiscoveryList.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/QuizDiscoveryList.java index 41450451..7257224f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/QuizDiscoveryList.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/QuizDiscoveryList.java @@ -51,6 +51,18 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; public class QuizDiscoveryList implements TemplateComposer { // localized text keys + private static final LocTextKey QUIZ_DETAILS_URL_TEXT_KEY = + new LocTextKey("sebserver.quizdiscovery.quiz.details.url"); + private static final LocTextKey QUIZ_DETAILS_ENDTIME_TEXT_KEY = + new LocTextKey("sebserver.quizdiscovery.quiz.details.endtime"); + private static final LocTextKey QUIZ_DETAILS_STARTTIME_TEXT_KEY = + new LocTextKey("sebserver.quizdiscovery.quiz.details.starttime"); + private static final LocTextKey QUIZ_DETAILS_DESCRIPTION_TEXT_KEY = + new LocTextKey("sebserver.quizdiscovery.quiz.details.description"); + private static final LocTextKey QUIZ_DETAILS_NAME_TEXT_KEY = + new LocTextKey("sebserver.quizdiscovery.quiz.details.name"); + private static final LocTextKey QUIZ_DETAILS_LMS_TEXT_KEY = + new LocTextKey("sebserver.quizdiscovery.quiz.details.lms"); private static final LocTextKey TITLE_TEXT_KEY = new LocTextKey("sebserver.quizdiscovery.list.title"); private static final LocTextKey EMPTY_LIST_TEXT_KEY = @@ -213,29 +225,29 @@ public class QuizDiscoveryList implements TemplateComposer { .readonly(true) .addField(FormBuilder.singleSelection( QuizData.QUIZ_ATTR_LMS_SETUP_ID, - "sebserver.quizdiscovery.quiz.details.lms", + QUIZ_DETAILS_LMS_TEXT_KEY, String.valueOf(quizData.lmsSetupId), () -> this.resourceService.lmsSetupResource())) .addField(FormBuilder.text( QuizData.QUIZ_ATTR_NAME, - "sebserver.quizdiscovery.quiz.details.name", + QUIZ_DETAILS_NAME_TEXT_KEY, quizData.name)) .addField(FormBuilder.text( QuizData.QUIZ_ATTR_DESCRIPTION, - "sebserver.quizdiscovery.quiz.details.description", + QUIZ_DETAILS_DESCRIPTION_TEXT_KEY, quizData.description) .asArea()) .addField(FormBuilder.text( QuizData.QUIZ_ATTR_START_TIME, - "sebserver.quizdiscovery.quiz.details.starttime", + QUIZ_DETAILS_STARTTIME_TEXT_KEY, this.widgetFactory.getI18nSupport().formatDisplayDate(quizData.startTime))) .addField(FormBuilder.text( QuizData.QUIZ_ATTR_END_TIME, - "sebserver.quizdiscovery.quiz.details.endtime", + QUIZ_DETAILS_ENDTIME_TEXT_KEY, this.widgetFactory.getI18nSupport().formatDisplayDate(quizData.startTime))) .addField(FormBuilder.text( QuizData.QUIZ_ATTR_START_URL, - "sebserver.quizdiscovery.quiz.details.url", + QUIZ_DETAILS_URL_TEXT_KEY, quizData.startURL)) .build(); this.widgetFactory.labelSeparator(pc.getParent()); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountChangePasswordForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountChangePasswordForm.java index b8f5ebfe..4fc52216 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountChangePasswordForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountChangePasswordForm.java @@ -46,6 +46,13 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; * password that is also required must match the administrators current password. */ public class UserAccountChangePasswordForm implements TemplateComposer { + private static final LocTextKey FORM_PASSWORD_NEW_TEXT_KEY = + new LocTextKey("sebserver.useraccount.form.password.new"); + private static final LocTextKey FORM_PASSWORD_NEW_CONFIRM_TEXT_KEY = + new LocTextKey("sebserver.useraccount.form.password.new.confirm"); + private static final LocTextKey FORM_PASSWORD_TEXT_KEY = + new LocTextKey("sebserver.useraccount.form.password"); + private final PageService pageService; private final RestService restService; private final CurrentUser currentUser; @@ -89,17 +96,17 @@ public class UserAccountChangePasswordForm implements TemplateComposer { entityKey.getModelId()) .addField(FormBuilder.text( PasswordChange.ATTR_NAME_PASSWORD, - "sebserver.useraccount.form.password") + FORM_PASSWORD_TEXT_KEY) .asPasswordField()) .addField(FormBuilder.text( PasswordChange.ATTR_NAME_NEW_PASSWORD, - "sebserver.useraccount.form.password.new") + FORM_PASSWORD_NEW_TEXT_KEY) .asPasswordField()) .addFieldIf( () -> entityKey != null, () -> FormBuilder.text( PasswordChange.ATTR_NAME_CONFIRM_NEW_PASSWORD, - "sebserver.useraccount.form.password.new.confirm") + FORM_PASSWORD_NEW_CONFIRM_TEXT_KEY) .asPasswordField()) .buildFor(this.restService.getRestCall(ChangePassword.class)); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java index 697ea134..f115f01f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java @@ -56,6 +56,23 @@ public class UserAccountForm implements TemplateComposer { private static final Logger log = LoggerFactory.getLogger(UserAccountForm.class); + private static final LocTextKey FORM_PASSWORD_CONFIRM_TEXT_KEY = + new LocTextKey("sebserver.useraccount.form.password.confirm"); + private static final LocTextKey FORM_PASSWORD_TEXT_KEY = + new LocTextKey("sebserver.useraccount.form.password"); + private static final LocTextKey FORM_ROLES_TEXT_KEY = + new LocTextKey("sebserver.useraccount.form.roles"); + private static final LocTextKey FORM_TIMEZONE_TEXT_KEY = + new LocTextKey("sebserver.useraccount.form.timezone"); + private static final LocTextKey FORM_MAIL_TEXT_KEY = + new LocTextKey("sebserver.useraccount.form.mail"); + private static final LocTextKey FORM_USERNAME_TEXT_KEY = + new LocTextKey("sebserver.useraccount.form.username"); + private static final LocTextKey FORM_NAME_TEXT_KEY = + new LocTextKey("sebserver.useraccount.form.name"); + private static final LocTextKey FORM_INSTITUTION_TEXT_KEY = + new LocTextKey("sebserver.useraccount.form.institution"); + private final PageService pageService; private final ResourceService resourceService; @@ -145,21 +162,21 @@ public class UserAccountForm implements TemplateComposer { isSEBAdmin, () -> FormBuilder.singleSelection( Domain.USER.ATTR_INSTITUTION_ID, - "sebserver.useraccount.form.institution", + FORM_INSTITUTION_TEXT_KEY, String.valueOf(userAccount.getInstitutionId()), () -> this.resourceService.institutionResource()) .readonlyIf(isNotNew)) .addField(FormBuilder.text( Domain.USER.ATTR_NAME, - "sebserver.useraccount.form.name", + FORM_NAME_TEXT_KEY, userAccount.getName())) .addField(FormBuilder.text( Domain.USER.ATTR_USERNAME, - "sebserver.useraccount.form.username", + FORM_USERNAME_TEXT_KEY, userAccount.getUsername())) .addField(FormBuilder.text( Domain.USER.ATTR_EMAIL, - "sebserver.useraccount.form.mail", + FORM_MAIL_TEXT_KEY, userAccount.getEmail())) // .addField(FormBuilder.singleSelection( // Domain.USER.ATTR_LANGUAGE, @@ -169,14 +186,14 @@ public class UserAccountForm implements TemplateComposer { // .readonly(true)) .addField(FormBuilder.singleSelection( Domain.USER.ATTR_TIMEZONE, - "sebserver.useraccount.form.timezone", + FORM_TIMEZONE_TEXT_KEY, userAccount.getTimeZone().getID(), this.resourceService::timeZoneResources)) .addFieldIf( () -> modifyGrant, () -> FormBuilder.multiSelection( USER_ROLE.REFERENCE_NAME, - "sebserver.useraccount.form.roles", + FORM_ROLES_TEXT_KEY, StringUtils.join(userAccount.getRoles(), Constants.LIST_SEPARATOR_CHAR), this.resourceService::userRoleResources) .visibleIf(writeGrant)) @@ -184,13 +201,13 @@ public class UserAccountForm implements TemplateComposer { isNew, () -> FormBuilder.text( PasswordChange.ATTR_NAME_NEW_PASSWORD, - "sebserver.useraccount.form.password") + FORM_PASSWORD_TEXT_KEY) .asPasswordField()) .addFieldIf( isNew, () -> FormBuilder.text( PasswordChange.ATTR_NAME_CONFIRM_NEW_PASSWORD, - "sebserver.useraccount.form.password.confirm") + FORM_PASSWORD_CONFIRM_TEXT_KEY) .asPasswordField()) .buildFor((entityKey == null) ? restService.getRestCall(NewUserAccount.class) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/form/FieldBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/form/FieldBuilder.java index da0e0a4f..4bdae6a3 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/form/FieldBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/form/FieldBuilder.java @@ -10,6 +10,8 @@ package ch.ethz.seb.sebserver.gui.form; import java.util.function.BooleanSupplier; +import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; + public abstract class FieldBuilder { int spanLabel = -1; int spanInput = -1; @@ -20,10 +22,10 @@ public abstract class FieldBuilder { boolean visible = true; final String name; - final String label; + final LocTextKey label; final T value; - protected FieldBuilder(final String name, final String label, final T value) { + protected FieldBuilder(final String name, final LocTextKey label, final T value) { this.name = name; this.label = label; this.value = value; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/form/FormBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/form/FormBuilder.java index b5b51016..e932d3f2 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/form/FormBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/form/FormBuilder.java @@ -28,6 +28,8 @@ import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.model.Entity; import ch.ethz.seb.sebserver.gbl.model.exam.Indicator.Threshold; import ch.ethz.seb.sebserver.gbl.util.Tuple; +import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport; +import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; 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.remote.webservice.api.RestCall; @@ -39,6 +41,7 @@ public class FormBuilder { private static final Logger log = LoggerFactory.getLogger(FormBuilder.class); + final I18nSupport i18nSupport; final PageService pageService; final WidgetFactory widgetFactory; public final PageContext pageContext; @@ -56,6 +59,7 @@ public class FormBuilder { final PageContext pageContext, final int rows) { + this.i18nSupport = pageService.getI18nSupport(); this.pageService = pageService; this.widgetFactory = pageService.getWidgetFactory(); this.pageContext = pageContext; @@ -193,17 +197,17 @@ public class FormBuilder { empty.setText(""); } - public static TextFieldBuilder text(final String name, final String label) { + public static TextFieldBuilder text(final String name, final LocTextKey label) { return new TextFieldBuilder(name, label, null); } - public static TextFieldBuilder text(final String name, final String label, final String value) { + public static TextFieldBuilder text(final String name, final LocTextKey label, final String value) { return new TextFieldBuilder(name, label, value); } public static SelectionFieldBuilder singleSelection( final String name, - final String label, + final LocTextKey label, final String value, final Supplier>> itemsSupplier) { @@ -212,7 +216,7 @@ public class FormBuilder { public static SelectionFieldBuilder multiSelection( final String name, - final String label, + final LocTextKey label, final String value, final Supplier>> itemsSupplier) { @@ -221,7 +225,7 @@ public class FormBuilder { public static SelectionFieldBuilder multiComboSelection( final String name, - final String label, + final LocTextKey label, final String value, final Supplier>> itemsSupplier) { @@ -230,7 +234,7 @@ public class FormBuilder { public static SelectionFieldBuilder colorSelection( final String name, - final String label, + final LocTextKey label, final String value) { return new SelectionFieldBuilder(Selection.Type.COLOR, name, label, value, null); @@ -238,17 +242,17 @@ public class FormBuilder { public static ThresholdListBuilder thresholdList( final String name, - final String label, + final LocTextKey label, final Collection value) { return new ThresholdListBuilder(name, label, value); } - public static ImageUploadFieldBuilder imageUpload(final String name, final String label, final String value) { + public static ImageUploadFieldBuilder imageUpload(final String name, final LocTextKey label, final String value) { return new ImageUploadFieldBuilder(name, label, value); } - Label labelLocalized(final Composite parent, final String locTextKey, final int hspan) { + Label labelLocalized(final Composite parent, final LocTextKey locTextKey, final int hspan) { final Label label = this.widgetFactory.labelLocalized(parent, locTextKey); final GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false, hspan, 1); gridData.verticalIndent = 4; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/form/ImageUploadFieldBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/form/ImageUploadFieldBuilder.java index 0e484da7..d559e453 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/form/ImageUploadFieldBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/form/ImageUploadFieldBuilder.java @@ -17,7 +17,7 @@ import ch.ethz.seb.sebserver.gui.widget.ImageUpload; public final class ImageUploadFieldBuilder extends FieldBuilder { - ImageUploadFieldBuilder(final String name, final String label, final String value) { + ImageUploadFieldBuilder(final String name, final LocTextKey label, final String value) { super(name, label, value); } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/form/SelectionFieldBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/form/SelectionFieldBuilder.java index 074b2ef6..e0b8366f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/form/SelectionFieldBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/form/SelectionFieldBuilder.java @@ -25,6 +25,7 @@ import org.eclipse.swt.widgets.Label; import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.util.Tuple; +import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; import ch.ethz.seb.sebserver.gui.service.i18n.PolyglotPageService; import ch.ethz.seb.sebserver.gui.widget.Selection; import ch.ethz.seb.sebserver.gui.widget.Selection.Type; @@ -39,7 +40,7 @@ public final class SelectionFieldBuilder extends FieldBuilder { SelectionFieldBuilder( final Selection.Type type, final String name, - final String label, + final LocTextKey label, final String value, final Supplier>> itemsSupplier) { diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/form/TextFieldBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/form/TextFieldBuilder.java index 3f0c56cd..2bb20f6b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/form/TextFieldBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/form/TextFieldBuilder.java @@ -13,13 +13,15 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; +import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; + public final class TextFieldBuilder extends FieldBuilder { boolean isPassword = false; boolean isNumber = false; boolean isArea = false; - TextFieldBuilder(final String name, final String label, final String value) { + TextFieldBuilder(final String name, final LocTextKey label, final String value) { super(name, label, value); } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/form/ThresholdListBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/form/ThresholdListBuilder.java index 1c4dd928..cb019c96 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/form/ThresholdListBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/form/ThresholdListBuilder.java @@ -19,13 +19,14 @@ import org.eclipse.swt.widgets.Label; import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.model.Domain; import ch.ethz.seb.sebserver.gbl.model.exam.Indicator.Threshold; +import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; import ch.ethz.seb.sebserver.gui.widget.ThresholdList; public class ThresholdListBuilder extends FieldBuilder> { protected ThresholdListBuilder( final String name, - final String label, + final LocTextKey label, final Collection value) { super(name, label, value);