SEBSERV-421

This commit is contained in:
anhefti 2023-04-13 13:58:55 +02:00
parent c6d6613264
commit 5de62a6050
2 changed files with 10 additions and 27 deletions

View file

@ -60,19 +60,6 @@ public class TextFieldListBuilder extends AbstractTableFieldBuilder {
final Composite innerGrid = InputFieldBuilder final Composite innerGrid = InputFieldBuilder
.createInnerGrid(parent, attribute, orientation); .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 String attributeNameKey = ExamConfigurationService.attributeNameKey(attribute);
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
gridData.minimumHeight = WidgetFactory.TEXT_AREA_INPUT_MIN_HEIGHT; gridData.minimumHeight = WidgetFactory.TEXT_AREA_INPUT_MIN_HEIGHT;

View file

@ -39,6 +39,7 @@ public class TextListInput extends Composite {
private final Button addAction; private final Button addAction;
private final Composite content; private final Composite content;
private final List<Row> list = new ArrayList<>(); private final List<Row> list = new ArrayList<>();
private final String tooltipText;
private Listener valueChangeEventListener = null; private Listener valueChangeEventListener = null;
@ -81,8 +82,10 @@ public class TextListInput extends Composite {
final LocTextKey toolTipKey = new LocTextKey(nameKey.name + ".tooltip"); final LocTextKey toolTipKey = new LocTextKey(nameKey.name + ".tooltip");
if (widgetFactory.getI18nSupport().hasText(toolTipKey)) { if (widgetFactory.getI18nSupport().hasText(toolTipKey)) {
label.setToolTipText(Utils.formatLineBreaks( this.tooltipText = Utils.formatLineBreaks(widgetFactory.getI18nSupport().getText(toolTipKey));
widgetFactory.getI18nSupport().getText(toolTipKey))); label.setToolTipText(this.tooltipText);
} else {
this.tooltipText = null;
} }
this.addAction = widgetFactory.imageButton( this.addAction = widgetFactory.imageButton(
@ -103,7 +106,7 @@ public class TextListInput extends Composite {
} }
void addRow(final Event event) { 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); this.content.getParent().getParent().layout(true, true);
} }
@ -156,10 +159,13 @@ public class TextListInput extends Composite {
public final Text textInput; public final Text textInput;
public final Button deleteButton; public final Button deleteButton;
public Row(final int index) { public Row(final int index, final String tooltipText) {
this.textInput = TextListInput.this.widgetFactory.textInput( this.textInput = TextListInput.this.widgetFactory.textInput(
TextListInput.this.content, TextListInput.this.content,
TextListInput.this.nameKey); TextListInput.this.nameKey);
if (tooltipText != null) {
this.textInput.setToolTipText(tooltipText);
}
GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
this.textInput.setEditable(TextListInput.this.isEditable); this.textInput.setEditable(TextListInput.this.isEditable);
if (TextListInput.this.isEditable) { if (TextListInput.this.isEditable) {
@ -198,16 +204,6 @@ public class TextListInput extends Composite {
TextListInput.this.valueChangeEventListener.handleEvent(null); 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);
// }
// }
} }
} }