From 5de62a60505235ce94188d9e2eeedfed70787ec7 Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 13 Apr 2023 13:58:55 +0200 Subject: [PATCH] SEBSERV-421 --- .../examconfig/impl/TextFieldListBuilder.java | 13 ---------- .../sebserver/gui/widget/TextListInput.java | 24 ++++++++----------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TextFieldListBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TextFieldListBuilder.java index a0c24f62..3de73a25 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TextFieldListBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/TextFieldListBuilder.java @@ -60,19 +60,6 @@ public class TextFieldListBuilder extends AbstractTableFieldBuilder { final Composite innerGrid = InputFieldBuilder .createInnerGrid(parent, attribute, orientation); -// final Composite scroll = PageService.createManagedVScrolledComposite( -// innerGrid, -// scrolledComposite -> { -// final Composite result = new Composite(scrolledComposite, SWT.NONE); -// final GridLayout gridLayout1 = new GridLayout(); -// result.setLayout(gridLayout1); -// final GridData gridData1 = new GridData(SWT.FILL, SWT.FILL, true, true); -// result.setLayoutData(gridData1); -// return result; -// }, -// false, -// false, true); - final String attributeNameKey = ExamConfigurationService.attributeNameKey(attribute); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); gridData.minimumHeight = WidgetFactory.TEXT_AREA_INPUT_MIN_HEIGHT; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/widget/TextListInput.java b/src/main/java/ch/ethz/seb/sebserver/gui/widget/TextListInput.java index 6153cd0b..690ddfb2 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/widget/TextListInput.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/widget/TextListInput.java @@ -39,6 +39,7 @@ public class TextListInput extends Composite { private final Button addAction; private final Composite content; private final List list = new ArrayList<>(); + private final String tooltipText; private Listener valueChangeEventListener = null; @@ -81,8 +82,10 @@ public class TextListInput extends Composite { final LocTextKey toolTipKey = new LocTextKey(nameKey.name + ".tooltip"); if (widgetFactory.getI18nSupport().hasText(toolTipKey)) { - label.setToolTipText(Utils.formatLineBreaks( - widgetFactory.getI18nSupport().getText(toolTipKey))); + this.tooltipText = Utils.formatLineBreaks(widgetFactory.getI18nSupport().getText(toolTipKey)); + label.setToolTipText(this.tooltipText); + } else { + this.tooltipText = null; } this.addAction = widgetFactory.imageButton( @@ -103,7 +106,7 @@ public class TextListInput extends Composite { } void addRow(final Event event) { - this.list.add(new Row(this.list.size())); + this.list.add(new Row(this.list.size(), this.tooltipText)); this.content.getParent().getParent().layout(true, true); } @@ -156,10 +159,13 @@ public class TextListInput extends Composite { public final Text textInput; public final Button deleteButton; - public Row(final int index) { + public Row(final int index, final String tooltipText) { this.textInput = TextListInput.this.widgetFactory.textInput( TextListInput.this.content, TextListInput.this.nameKey); + if (tooltipText != null) { + this.textInput.setToolTipText(tooltipText); + } GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true); this.textInput.setEditable(TextListInput.this.isEditable); if (TextListInput.this.isEditable) { @@ -198,16 +204,6 @@ public class TextListInput extends Composite { TextListInput.this.valueChangeEventListener.handleEvent(null); } } - -// public void setEditable(final boolean e) { -// this.textInput.setEditable(e); -// this.textInput.setData( -// RWT.CUSTOM_VARIANT, -// e ? null : CustomVariant.CONFIG_INPUT_READONLY.key); -// if (this.deleteButton != null) { -// this.deleteButton.setEnabled(e); -// } -// } } }