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.RWT;
import org.eclipse.rap.rwt.client.service.UrlLauncher; import org.eclipse.rap.rwt.client.service.UrlLauncher;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
@ -159,17 +158,15 @@ public class ExamCreateClientConfigPopup {
.collect(Collectors.toList()); .collect(Collectors.toList());
if (configs.isEmpty()) { if (configs.isEmpty()) {
final Label text = this.pageService this.pageService
.getWidgetFactory() .getWidgetFactory()
.labelLocalized(parent, NO_CONFIG_TEXT_KEY); .labelLocalized(parent, NO_CONFIG_TEXT_KEY, true);
text.setData(RWT.MARKUP_ENABLED, true);
return null; return null;
} else { } else {
final Label text = this.pageService this.pageService
.getWidgetFactory() .getWidgetFactory()
.labelLocalized(parent, CONFIG_TEXT_KEY); .labelLocalized(parent, CONFIG_TEXT_KEY, true);
text.setData(RWT.MARKUP_ENABLED, true);
final FormHandle<ConfigCreationInfo> formHandle = this.pageService.formBuilder( final FormHandle<ConfigCreationInfo> formHandle = this.pageService.formBuilder(
this.pageContext.copyOf(parent)) this.pageContext.copyOf(parent))

View file

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

View file

@ -10,7 +10,6 @@ package ch.ethz.seb.sebserver.gui.service.examconfig.impl;
import java.util.Collection; import java.util.Collection;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
@ -83,9 +82,8 @@ interface CellFieldBuilderAdapter {
final Label label = widgetFactory.labelLocalized( final Label label = widgetFactory.labelLocalized(
builder.parent, builder.parent,
new LocTextKey(ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + attribute.name, new LocTextKey(ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + attribute.name,
attribute.name)); attribute.name),
label.setData(RWT.MARKUP_ENABLED, true); true);
final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false); final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
switch (orientation.title) { switch (orientation.title) {
case LEFT: case LEFT:
@ -97,7 +95,7 @@ interface CellFieldBuilderAdapter {
case RIGHT_SPAN: case RIGHT_SPAN:
case LEFT_SPAN: { case LEFT_SPAN: {
label.setAlignment(SWT.LEFT); label.setAlignment(SWT.LEFT);
gridData.horizontalSpan = (span > 1) ? span : orientation.width; gridData.horizontalSpan = (this.span > 1) ? this.span : orientation.width;
gridData.verticalIndent = 5; gridData.verticalIndent = 5;
break; break;
} }
@ -123,7 +121,7 @@ interface CellFieldBuilderAdapter {
} }
if (orientation.title == TitleOrientation.LEFT_SPAN) { if (orientation.title == TitleOrientation.LEFT_SPAN) {
int xpos = x - 1; 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] = this;
grid[y][xpos + 1] = DUMMY_BUILDER_ADAPTER; grid[y][xpos + 1] = DUMMY_BUILDER_ADAPTER;
this.span++; this.span++;

View file

@ -8,7 +8,6 @@
package ch.ethz.seb.sebserver.gui.service.examconfig.impl; 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.Composite;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
@ -54,8 +53,8 @@ public class LabelBuilder implements InputFieldBuilder {
final Label label = this.widgetFactory.labelLocalized( final Label label = this.widgetFactory.labelLocalized(
parent, parent,
ExamConfigurationService.attributeNameLocKey(attribute)); ExamConfigurationService.attributeNameLocKey(attribute),
label.setData(RWT.MARKUP_ENABLED, true); true);
return new LabelField( return new LabelField(
attribute, attribute,

View file

@ -388,7 +388,14 @@ public class WidgetFactory {
} }
public Label labelLocalized(final Composite parent, final LocTextKey locTextKey) { 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); final Label label = new Label(parent, SWT.NONE);
if (enableMarkup) {
label.setData(RWT.MARKUP_ENABLED, true);
}
this.polyglotPageService.injectI18n(label, locTextKey); this.polyglotPageService.injectI18n(label, locTextKey);
return label; return label;
} }

View file

@ -528,12 +528,14 @@ public class ExamConfigurationMapDAOImpl implements ExamConfigurationMapDAO {
} }
private EntityDependency getDependency(final ExamConfigurationMap model, final EntityKey parent) { 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( return new EntityDependency(
parent, parent,
new EntityKey(model.getId(), EntityType.EXAM_CONFIGURATION_MAP), new EntityKey(model.getId(), EntityType.EXAM_CONFIGURATION_MAP),
Utils.valueOrEmptyNote(model.getExamName()) + " / " + Utils.valueOrEmptyNote(model.getConfigName()), Utils.valueOrEmptyNote(model.getExamName()) + " / " + Utils.valueOrEmptyNote(model.getConfigName()),
Utils.valueOrEmptyNote(model.getExamDescription()) + " / " description);
+ Utils.valueOrEmptyNote(model.getConfigDescription()));
} }
private String getEncryptionPassword(final ExamConfigurationMap examConfigurationMap) { private String getEncryptionPassword(final ExamConfigurationMap examConfigurationMap) {