From 4734b1a3b3eea280d406a32833991f49b3a2cd41 Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 27 Jan 2021 10:02:08 +0100 Subject: [PATCH] fixed GUI issues --- .../gui/content/ExamCreateClientConfigPopup.java | 11 ++++------- .../seb/sebserver/gui/content/ExamDeletePopup.java | 2 +- .../examconfig/impl/CellFieldBuilderAdapter.java | 10 ++++------ .../gui/service/examconfig/impl/LabelBuilder.java | 5 ++--- .../ethz/seb/sebserver/gui/widget/WidgetFactory.java | 7 +++++++ .../dao/impl/ExamConfigurationMapDAOImpl.java | 6 ++++-- 6 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamCreateClientConfigPopup.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamCreateClientConfigPopup.java index 28244cd0..e9dcd107 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamCreateClientConfigPopup.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamCreateClientConfigPopup.java @@ -18,7 +18,6 @@ import org.apache.commons.lang3.StringUtils; import org.eclipse.rap.rwt.RWT; import org.eclipse.rap.rwt.client.service.UrlLauncher; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.springframework.context.annotation.Lazy; @@ -159,17 +158,15 @@ public class ExamCreateClientConfigPopup { .collect(Collectors.toList()); if (configs.isEmpty()) { - final Label text = this.pageService + this.pageService .getWidgetFactory() - .labelLocalized(parent, NO_CONFIG_TEXT_KEY); - text.setData(RWT.MARKUP_ENABLED, true); + .labelLocalized(parent, NO_CONFIG_TEXT_KEY, true); return null; } else { - final Label text = this.pageService + this.pageService .getWidgetFactory() - .labelLocalized(parent, CONFIG_TEXT_KEY); - text.setData(RWT.MARKUP_ENABLED, true); + .labelLocalized(parent, CONFIG_TEXT_KEY, true); final FormHandle formHandle = this.pageService.formBuilder( this.pageContext.copyOf(parent)) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamDeletePopup.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamDeletePopup.java index 1b9dd457..49b3341f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamDeletePopup.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/ExamDeletePopup.java @@ -199,7 +199,7 @@ public class ExamDeletePopup { "FORM_REPORT_LIST_NAME", FORM_REPORT_LIST_NAME, dep -> dep.name)) - .withColumn(new ColumnDefinition<>( + .withColumn(new ColumnDefinition( "FORM_REPORT_LIST_DESC", FORM_REPORT_LIST_DESC, dep -> dep.description)) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java index dba39ec5..5f497969 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java @@ -10,7 +10,6 @@ package ch.ethz.seb.sebserver.gui.service.examconfig.impl; import java.util.Collection; -import org.eclipse.rap.rwt.RWT; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Group; @@ -83,9 +82,8 @@ interface CellFieldBuilderAdapter { final Label label = widgetFactory.labelLocalized( builder.parent, new LocTextKey(ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + attribute.name, - attribute.name)); - label.setData(RWT.MARKUP_ENABLED, true); - + attribute.name), + true); final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); switch (orientation.title) { case LEFT: @@ -97,7 +95,7 @@ interface CellFieldBuilderAdapter { case RIGHT_SPAN: case LEFT_SPAN: { label.setAlignment(SWT.LEFT); - gridData.horizontalSpan = (span > 1) ? span : orientation.width; + gridData.horizontalSpan = (this.span > 1) ? this.span : orientation.width; gridData.verticalIndent = 5; break; } @@ -123,7 +121,7 @@ interface CellFieldBuilderAdapter { } if (orientation.title == TitleOrientation.LEFT_SPAN) { int xpos = x - 1; - while (xpos >= 0 && grid[y][xpos] == null && span < orientation.width) { + while (xpos >= 0 && grid[y][xpos] == null && this.span < orientation.width) { grid[y][xpos] = this; grid[y][xpos + 1] = DUMMY_BUILDER_ADAPTER; this.span++; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/LabelBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/LabelBuilder.java index 71c8f62f..82f06390 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/LabelBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/LabelBuilder.java @@ -8,7 +8,6 @@ package ch.ethz.seb.sebserver.gui.service.examconfig.impl; -import org.eclipse.rap.rwt.RWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.springframework.context.annotation.Lazy; @@ -54,8 +53,8 @@ public class LabelBuilder implements InputFieldBuilder { final Label label = this.widgetFactory.labelLocalized( parent, - ExamConfigurationService.attributeNameLocKey(attribute)); - label.setData(RWT.MARKUP_ENABLED, true); + ExamConfigurationService.attributeNameLocKey(attribute), + true); return new LabelField( attribute, diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java b/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java index 8d963e35..1ec77bc4 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java @@ -388,7 +388,14 @@ public class WidgetFactory { } public Label labelLocalized(final Composite parent, final LocTextKey locTextKey) { + return labelLocalized(parent, locTextKey, false); + } + + public Label labelLocalized(final Composite parent, final LocTextKey locTextKey, final boolean enableMarkup) { final Label label = new Label(parent, SWT.NONE); + if (enableMarkup) { + label.setData(RWT.MARKUP_ENABLED, true); + } this.polyglotPageService.injectI18n(label, locTextKey); return label; } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamConfigurationMapDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamConfigurationMapDAOImpl.java index 766e7cd9..cc5a5761 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamConfigurationMapDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamConfigurationMapDAOImpl.java @@ -528,12 +528,14 @@ public class ExamConfigurationMapDAOImpl implements ExamConfigurationMapDAO { } private EntityDependency getDependency(final ExamConfigurationMap model, final EntityKey parent) { + final String description = (Utils.valueOrEmptyNote(model.getExamDescription()) + " / " + + Utils.valueOrEmptyNote(model.getConfigDescription())).replaceAll("(?s)<[^>]*>(\\s*<[^>]*>)*", + " "); return new EntityDependency( parent, new EntityKey(model.getId(), EntityType.EXAM_CONFIGURATION_MAP), Utils.valueOrEmptyNote(model.getExamName()) + " / " + Utils.valueOrEmptyNote(model.getConfigName()), - Utils.valueOrEmptyNote(model.getExamDescription()) + " / " - + Utils.valueOrEmptyNote(model.getConfigDescription())); + description); } private String getEncryptionPassword(final ExamConfigurationMap examConfigurationMap) {