fixed GUI issues

This commit is contained in:
anhefti 2021-01-27 10:02:08 +01:00
parent ff31692160
commit 4734b1a3b3
6 changed files with 22 additions and 19 deletions

View file

@ -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<ConfigCreationInfo> formHandle = this.pageService.formBuilder(
this.pageContext.copyOf(parent))

View file

@ -199,7 +199,7 @@ public class ExamDeletePopup {
"FORM_REPORT_LIST_NAME",
FORM_REPORT_LIST_NAME,
dep -> dep.name))
.withColumn(new ColumnDefinition<>(
.withColumn(new ColumnDefinition<EntityDependency>(
"FORM_REPORT_LIST_DESC",
FORM_REPORT_LIST_DESC,
dep -> dep.description))

View file

@ -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++;

View file

@ -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,

View file

@ -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;
}

View file

@ -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) {