Merge remote-tracking branch 'origin/dev-1.2-gui-testing' into
development Conflicts: src/main/java/ch/ethz/seb/sebserver/gui/table/TableFilter.java src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java
This commit is contained in:
		
						commit
						3afed86efa
					
				
					 18 changed files with 157 additions and 109 deletions
				
			
		|  | @ -48,6 +48,9 @@ public class ProctorRoomConnectionsPopup { | |||
| 
 | ||||
|     private static final LocTextKey TITLE_TEXT_KEY = | ||||
|             new LocTextKey("sebserver.monitoring.exam.proctoring.room.connections.title"); | ||||
|     private static final LocTextKey JOIN_TEXT_KEY = | ||||
|             new LocTextKey("sebserver.monitoring.exam.proctoring.room.connections.joinurl"); | ||||
| 
 | ||||
|     private static final LocTextKey EMPTY_LIST_TEXT_KEY = | ||||
|             new LocTextKey("sebserver.monitoring.search.list.empty"); | ||||
|     private static final LocTextKey TABLE_COLUMN_NAME = | ||||
|  | @ -81,16 +84,19 @@ public class ProctorRoomConnectionsPopup { | |||
|         if (StringUtils.isNotBlank(joinLink)) { | ||||
|             final WidgetFactory widgetFactory = this.pageService.getWidgetFactory(); | ||||
| 
 | ||||
|             final String ariaLabel = widgetFactory.getI18nSupport().getText(JOIN_TEXT_KEY) + joinLink; | ||||
|             final String testKey = JOIN_TEXT_KEY.name; | ||||
| 
 | ||||
|             final Composite titleComp = widgetFactory.voidComposite(pageContext.getParent()); | ||||
|             final GridLayout layout = (GridLayout) titleComp.getLayout(); | ||||
|             layout.numColumns = 2; | ||||
|             layout.makeColumnsEqualWidth = false; | ||||
| 
 | ||||
|             final Label label = widgetFactory.label(titleComp, "Join URL: "); | ||||
|             final Label label = widgetFactory.labelLocalized(titleComp, JOIN_TEXT_KEY); | ||||
|             label.setLayoutData(new GridData()); | ||||
|             label.setData(RWT.CUSTOM_VARIANT, CustomVariant.TITLE_LABEL.key); | ||||
| 
 | ||||
|             final Text textInput = widgetFactory.textInput(titleComp, joinLink); | ||||
|             final Text textInput = widgetFactory.textInput(titleComp, testKey, ariaLabel); | ||||
|             final GridData gridData = new GridData(SWT.LEFT, SWT.TOP, false, false); | ||||
|             textInput.setLayoutData(gridData); | ||||
|             textInput.setText(joinLink); | ||||
|  |  | |||
|  | @ -76,7 +76,7 @@ public final class SelectionFieldBuilder extends FieldBuilder<String> { | |||
|                 (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) ? this.tooltip : null, | ||||
|                 null, | ||||
|                 actionKey, | ||||
|                 getARIALabel(builder)); | ||||
|                 builder.i18nSupport.getText(getARIALabel(builder))); | ||||
| 
 | ||||
|         final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); | ||||
|         ((Control) selection).setLayoutData(gridData); | ||||
|  |  | |||
|  | @ -75,6 +75,7 @@ public class CheckBoxBuilder implements InputFieldBuilder { | |||
|                         ? ExamConfigurationService.attributeNameLocKey(attribute) | ||||
|                         : null, | ||||
|                 ExamConfigurationService.getToolTipKey(attribute, i18nSupport), | ||||
|                 ExamConfigurationService.attributeNameLocKey(attribute).name, | ||||
|                 ExamConfigurationService.attributeNameLocKey(attribute)); | ||||
| 
 | ||||
|         final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); | ||||
|  |  | |||
|  | @ -21,6 +21,7 @@ import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; | |||
| import ch.ethz.seb.sebserver.gui.service.examconfig.ExamConfigurationService; | ||||
| import ch.ethz.seb.sebserver.gui.service.examconfig.InputField; | ||||
| import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder; | ||||
| import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport; | ||||
| import ch.ethz.seb.sebserver.gui.widget.MultiSelectionCheckbox; | ||||
| import ch.ethz.seb.sebserver.gui.widget.Selection; | ||||
| import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; | ||||
|  | @ -50,18 +51,21 @@ public class MultiCheckboxSelection extends SelectionFieldBuilder implements Inp | |||
|             final ConfigurationAttribute attribute, | ||||
|             final ViewContext viewContext) { | ||||
| 
 | ||||
|         final I18nSupport i18nSupport = this.widgetFactory.getI18nSupport(); | ||||
|         final Orientation orientation = viewContext | ||||
|                 .getOrientation(attribute.id); | ||||
|         final Composite innerGrid = InputFieldBuilder | ||||
|                 .createInnerGrid(parent, attribute, orientation); | ||||
| 
 | ||||
|         final String attributeNameKey = ExamConfigurationService.attributeNameKey(attribute); | ||||
|         final MultiSelectionCheckbox selection = this.widgetFactory.selectionLocalized( | ||||
|                 Selection.Type.MULTI_CHECKBOX, | ||||
|                 innerGrid, | ||||
|                 () -> this.getLocalizedResources(attribute, viewContext), | ||||
|                 null, | ||||
|                 () -> this.getLocalizedResourcesAsToolTip(attribute, viewContext), | ||||
|                 ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + attribute.name) | ||||
|                 attributeNameKey, | ||||
|                 i18nSupport.getText(attributeNameKey)) | ||||
|                 .getTypeInstance(); | ||||
| 
 | ||||
|         selection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | ||||
|  |  | |||
|  | @ -37,6 +37,8 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant; | |||
| @GuiProfile | ||||
| public class PasswordFieldBuilder implements InputFieldBuilder { | ||||
| 
 | ||||
|     private static final String SEBSERVER_FORM_CONFIRM_LABEL = "sebserver.form.confirm.label"; | ||||
| 
 | ||||
|     private static final LocTextKey VAL_CONFIRM_PWD_TEXT_KEY = | ||||
|             new LocTextKey("sebserver.examconfig.props.validation.password.confirm"); | ||||
| 
 | ||||
|  | @ -84,7 +86,7 @@ public class PasswordFieldBuilder implements InputFieldBuilder { | |||
| 
 | ||||
|         final LocTextKey confirmNameLocKey = | ||||
|                 new LocTextKey( | ||||
|                         "sebserver.form.confirm.label", | ||||
|                         SEBSERVER_FORM_CONFIRM_LABEL, | ||||
|                         viewContext.i18nSupport.getText(attributeNameLocKey)); | ||||
|         final PasswordInput confirmInput = new PasswordInput( | ||||
|                 innerGrid, | ||||
|  |  | |||
|  | @ -22,6 +22,7 @@ import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; | |||
| import ch.ethz.seb.sebserver.gui.service.examconfig.ExamConfigurationService; | ||||
| import ch.ethz.seb.sebserver.gui.service.examconfig.InputField; | ||||
| import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder; | ||||
| import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport; | ||||
| import ch.ethz.seb.sebserver.gui.widget.RadioSelection; | ||||
| import ch.ethz.seb.sebserver.gui.widget.Selection; | ||||
| import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; | ||||
|  | @ -52,18 +53,21 @@ public class RadioSelectionFieldBuilder extends SelectionFieldBuilder implements | |||
|             final ConfigurationAttribute attribute, | ||||
|             final ViewContext viewContext) { | ||||
| 
 | ||||
|         final I18nSupport i18nSupport = this.widgetFactory.getI18nSupport(); | ||||
|         final Orientation orientation = viewContext | ||||
|                 .getOrientation(attribute.id); | ||||
|         final Composite innerGrid = InputFieldBuilder | ||||
|                 .createInnerGrid(parent, attribute, orientation); | ||||
| 
 | ||||
|         final String attributeNameKey = ExamConfigurationService.attributeNameKey(attribute); | ||||
|         final RadioSelection selection = this.widgetFactory.selectionLocalized( | ||||
|                 Selection.Type.RADIO, | ||||
|                 innerGrid, | ||||
|                 () -> this.getLocalizedResources(attribute, viewContext), | ||||
|                 null, | ||||
|                 () -> this.getLocalizedResourcesAsToolTip(attribute, viewContext), | ||||
|                 ExamConfigurationService.ATTRIBUTE_LABEL_LOC_TEXT_PREFIX + attribute.name) | ||||
|                 attributeNameKey, | ||||
|                 i18nSupport.getText(attributeNameKey)) | ||||
|                 .getTypeInstance(); | ||||
| 
 | ||||
|         selection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ import ch.ethz.seb.sebserver.gui.service.examconfig.ExamConfigurationService; | |||
| import ch.ethz.seb.sebserver.gui.service.examconfig.InputField; | ||||
| import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder; | ||||
| import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport; | ||||
| import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; | ||||
| import ch.ethz.seb.sebserver.gui.widget.Selection; | ||||
| import ch.ethz.seb.sebserver.gui.widget.SingleSelection; | ||||
| import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; | ||||
|  | @ -60,13 +61,18 @@ public class SingleSelectionFieldBuilder extends SelectionFieldBuilder implement | |||
|         final Composite innerGrid = InputFieldBuilder | ||||
|                 .createInnerGrid(parent, attribute, orientation); | ||||
| 
 | ||||
|         final LocTextKey toolTipKey = ExamConfigurationService.getToolTipKey(attribute, i18nSupport); | ||||
|         final String attributeNameKey = ExamConfigurationService.attributeNameKey(attribute); | ||||
|         final SingleSelection selection = this.widgetFactory.selectionLocalized( | ||||
|                 (attribute.type == AttributeType.COMBO_SELECTION) | ||||
|                         ? Selection.Type.SINGLE_COMBO | ||||
|                         : Selection.Type.SINGLE, | ||||
|                 innerGrid, | ||||
|                 () -> this.getLocalizedResources(attribute, viewContext), | ||||
|                 ExamConfigurationService.getToolTipKey(attribute, i18nSupport)) | ||||
|                 toolTipKey, | ||||
|                 null, | ||||
|                 attributeNameKey, | ||||
|                 i18nSupport.getText(attributeNameKey)) | ||||
|                 .getTypeInstance(); | ||||
| 
 | ||||
|         selection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); | ||||
|  |  | |||
|  | @ -87,6 +87,9 @@ public class TextFieldBuilder implements InputFieldBuilder { | |||
|             } | ||||
|         } | ||||
|         text.setLayoutData(gridData); | ||||
|         final String attributeNameKey = ExamConfigurationService.attributeNameKey(attribute); | ||||
|         WidgetFactory.setTestId(text, attributeNameKey); | ||||
|         WidgetFactory.setARIALabel(text, i18nSupport.getText(attributeNameKey)); | ||||
| 
 | ||||
|         final LocTextKey toolTipKey = ExamConfigurationService.getToolTipKey( | ||||
|                 attribute, | ||||
|  |  | |||
|  | @ -328,6 +328,7 @@ public class TableFilter<ROW> { | |||
| 
 | ||||
|             this.textInput = TableFilter.this.entityTable.widgetFactory.textInput( | ||||
|                     innerComposite, | ||||
|                     TableFilter.this.entityTable.getName() + "_" + this.attribute.columnName, | ||||
|                     getAriaLabel()); | ||||
| 
 | ||||
|             this.textInput.setLayoutData(gridData); | ||||
|  | @ -354,7 +355,6 @@ public class TableFilter<ROW> { | |||
|                 this.textInput.setText(value); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     private class SelectionFilter extends FilterComponent { | ||||
|  | @ -387,7 +387,9 @@ public class TableFilter<ROW> { | |||
|                             ch.ethz.seb.sebserver.gui.widget.Selection.Type.SINGLE, | ||||
|                             innerComposite, | ||||
|                             resourceSupplier, | ||||
|                             getAriaLabel()); | ||||
|                             null, null, | ||||
|                             TableFilter.this.entityTable.getName() + "_" + this.attribute.columnName, | ||||
|                             TableFilter.this.entityTable.widgetFactory.getI18nSupport().getText(getAriaLabel())); | ||||
| 
 | ||||
|             this.selector | ||||
|                     .adaptToControl() | ||||
|  | @ -446,7 +448,8 @@ public class TableFilter<ROW> { | |||
|             final Composite innerComposite = createInnerComposite(parent); | ||||
|             this.selector = TableFilter.this.entityTable.widgetFactory.dateSelector( | ||||
|                     innerComposite, | ||||
|                     getAriaLabel()); | ||||
|                     getAriaLabel(), | ||||
|                     TableFilter.this.entityTable.getName() + "_" + this.attribute.columnName); | ||||
|             this.selector.addListener(SWT.Selection, event -> { | ||||
|                 TableFilter.this.entityTable.applyFilter(); | ||||
|             }); | ||||
|  | @ -540,26 +543,27 @@ public class TableFilter<ROW> { | |||
|             this.innerComposite.setLayout(gridLayout); | ||||
|             this.innerComposite.setLayoutData(this.rowData); | ||||
| 
 | ||||
|             final String testKey = TableFilter.this.entityTable.getName() + "_" + this.attribute.columnName; | ||||
|             final WidgetFactory wf = TableFilter.this.entityTable.widgetFactory; | ||||
|             wf.labelLocalized(this.innerComposite, DATE_FROM_TEXT); | ||||
|             this.fromDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel()); | ||||
|             this.fromDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel(), testKey); | ||||
|             this.fromDateSelector.addListener(SWT.Selection, event -> { | ||||
|                 TableFilter.this.entityTable.applyFilter(); | ||||
|             }); | ||||
|             if (this.withTime) { | ||||
|                 this.fromTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel()); | ||||
|                 this.fromTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel(), testKey); | ||||
|                 this.fromTimeSelector.addListener(SWT.Selection, event -> { | ||||
|                     TableFilter.this.entityTable.applyFilter(); | ||||
|                 }); | ||||
|             } | ||||
| 
 | ||||
|             wf.labelLocalized(this.innerComposite, DATE_TO_TEXT); | ||||
|             this.toDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel()); | ||||
|             this.toDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel(), testKey); | ||||
|             this.toDateSelector.addListener(SWT.Selection, event -> { | ||||
|                 TableFilter.this.entityTable.applyFilter(); | ||||
|             }); | ||||
|             if (this.withTime) { | ||||
|                 this.toTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel()); | ||||
|                 this.toTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel(), testKey); | ||||
|                 this.toTimeSelector.addListener(SWT.Selection, event -> { | ||||
|                     TableFilter.this.entityTable.applyFilter(); | ||||
|                 }); | ||||
|  |  | |||
|  | @ -96,6 +96,10 @@ public final class ColorSelection extends Composite implements Selection { | |||
|         actionCell.widthHint = ACTION_COLUMN_WIDTH; | ||||
|         imageButton.setLayoutData(actionCell); | ||||
| 
 | ||||
|         if (tooltipKeyPrefix != null) { | ||||
|             WidgetFactory.setTestId(this, tooltipKeyPrefix); | ||||
|         } | ||||
| 
 | ||||
|         this.addListener(SWT.Resize, this::adaptColumnWidth); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -33,10 +33,11 @@ public final class MultiSelection extends Composite implements Selection { | |||
| 
 | ||||
|     private final List<Label> labels = new ArrayList<>(); | ||||
|     private final List<Label> selected = new ArrayList<>(); | ||||
|     private final String testKey; | ||||
| 
 | ||||
|     private Listener listener = null; | ||||
| 
 | ||||
|     MultiSelection(final Composite parent) { | ||||
|     MultiSelection(final Composite parent, final String testKey) { | ||||
|         super(parent, SWT.NONE); | ||||
|         final GridLayout gridLayout = new GridLayout(1, true); | ||||
|         gridLayout.verticalSpacing = 1; | ||||
|  | @ -44,6 +45,10 @@ public final class MultiSelection extends Composite implements Selection { | |||
|         gridLayout.marginHeight = 0; | ||||
|         gridLayout.marginWidth = 0; | ||||
|         setLayout(gridLayout); | ||||
|         this.testKey = testKey; | ||||
|         if (testKey != null) { | ||||
|             WidgetFactory.setTestId(this, testKey); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | @ -88,6 +93,8 @@ public final class MultiSelection extends Composite implements Selection { | |||
|                     this.listener.handleEvent(event); | ||||
|                 } | ||||
|             }); | ||||
|             WidgetFactory.setARIALabel(label, tuple._2); | ||||
|             WidgetFactory.setTestId(label, (this.testKey != null) ? this.testKey + tuple._1 : tuple._1); | ||||
|             this.labels.add(label); | ||||
|         } | ||||
|         if (StringUtils.isNotBlank(selectionValue)) { | ||||
|  |  | |||
|  | @ -34,7 +34,7 @@ public final class MultiSelectionCheckbox extends Composite implements Selection | |||
|     private Listener listener = null; | ||||
|     private final Map<String, Button> checkboxes; | ||||
| 
 | ||||
|     MultiSelectionCheckbox(final Composite parent) { | ||||
|     MultiSelectionCheckbox(final Composite parent, final String testKey) { | ||||
|         super(parent, SWT.NONE); | ||||
|         final GridLayout gridLayout = new GridLayout(1, true); | ||||
|         gridLayout.verticalSpacing = 1; | ||||
|  | @ -42,6 +42,9 @@ public final class MultiSelectionCheckbox extends Composite implements Selection | |||
|         gridLayout.marginHeight = 0; | ||||
|         gridLayout.marginWidth = 0; | ||||
|         setLayout(gridLayout); | ||||
|         if (testKey != null) { | ||||
|             WidgetFactory.setTestId(this, testKey); | ||||
|         } | ||||
| 
 | ||||
|         this.checkboxes = new LinkedHashMap<>(); | ||||
|     } | ||||
|  | @ -65,6 +68,8 @@ public final class MultiSelectionCheckbox extends Composite implements Selection | |||
|         for (final Tuple<String> tuple : mapping) { | ||||
|             final Button button = new Button(this, SWT.CHECK); | ||||
|             button.setText(tuple._2); | ||||
|             WidgetFactory.setARIALabel(button, tuple._2); | ||||
|             WidgetFactory.setTestId(button, tuple._1); | ||||
|             final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true); | ||||
|             button.setLayoutData(gridData); | ||||
|             button.setData(OPTION_VALUE, tuple._1); | ||||
|  | @ -73,6 +78,8 @@ public final class MultiSelectionCheckbox extends Composite implements Selection | |||
|                     this.listener.handleEvent(event); | ||||
|                 } | ||||
|             }); | ||||
|             WidgetFactory.setTestId(button, tuple._1); | ||||
|             WidgetFactory.setARIALabel(button, tuple._2); | ||||
|             this.checkboxes.put(tuple._1, button); | ||||
| 
 | ||||
|             @SuppressWarnings("unchecked") | ||||
|  |  | |||
|  | @ -69,7 +69,7 @@ public final class MultiSelectionCombo extends Composite implements Selection { | |||
|         setLayout(gridLayout); | ||||
| 
 | ||||
|         this.addListener(SWT.Resize, this::adaptColumnWidth); | ||||
|         this.textInput = widgetFactory.textInput(this, "selection"); | ||||
|         this.textInput = widgetFactory.textInput(this, locTextPrefix, "selection"); | ||||
|         this.textCell = new GridData(SWT.LEFT, SWT.CENTER, true, true); | ||||
|         this.textInput.setLayoutData(this.textCell); | ||||
|         this.dropDown = new DropDown(this.textInput, SWT.NONE); | ||||
|  |  | |||
|  | @ -36,6 +36,7 @@ public class PasswordInput extends Composite { | |||
|     private boolean isPlainText = true; | ||||
|     private boolean isEditable = true; | ||||
|     private String label = null; | ||||
|     private String testKey = null; | ||||
| 
 | ||||
|     public PasswordInput( | ||||
|             final Composite parent, | ||||
|  | @ -45,6 +46,7 @@ public class PasswordInput extends Composite { | |||
|         super(parent, SWT.NONE); | ||||
| 
 | ||||
|         this.label = widgetFactory.getI18nSupport().getText(label); | ||||
|         this.testKey = (label != null) ? label.name : null; | ||||
|         GridLayout gridLayout = new GridLayout(2, false); | ||||
|         gridLayout.horizontalSpacing = 0; | ||||
|         gridLayout.verticalSpacing = 0; | ||||
|  | @ -115,6 +117,7 @@ public class PasswordInput extends Composite { | |||
| 
 | ||||
|         if (this.label != null) { | ||||
|             WidgetFactory.setARIALabel(passwordInput, this.label); | ||||
|             WidgetFactory.setTestId(passwordInput, this.testKey); | ||||
|         } | ||||
| 
 | ||||
|         this.passwordInputField = passwordInput; | ||||
|  |  | |||
|  | @ -28,10 +28,11 @@ public final class RadioSelection extends Composite implements Selection { | |||
| 
 | ||||
|     private static final long serialVersionUID = 7937242481193100852L; | ||||
| 
 | ||||
|     private final String testKey; | ||||
|     private Listener listener = null; | ||||
|     private final Map<String, Button> radioButtons; | ||||
| 
 | ||||
|     RadioSelection(final Composite parent) { | ||||
|     RadioSelection(final Composite parent, final String testKey) { | ||||
|         super(parent, SWT.NONE); | ||||
|         final GridLayout gridLayout = new GridLayout(1, true); | ||||
|         gridLayout.verticalSpacing = 1; | ||||
|  | @ -39,6 +40,10 @@ public final class RadioSelection extends Composite implements Selection { | |||
|         gridLayout.marginHeight = 0; | ||||
|         gridLayout.marginWidth = 0; | ||||
|         setLayout(gridLayout); | ||||
|         this.testKey = testKey; | ||||
|         if (testKey != null) { | ||||
|             WidgetFactory.setTestId(this, testKey); | ||||
|         } | ||||
| 
 | ||||
|         this.radioButtons = new LinkedHashMap<>(); | ||||
|     } | ||||
|  | @ -70,6 +75,8 @@ public final class RadioSelection extends Composite implements Selection { | |||
|                     this.listener.handleEvent(event); | ||||
|                 } | ||||
|             }); | ||||
|             WidgetFactory.setTestId(button, (this.testKey != null) ? this.testKey + tuple._1 : tuple._1); | ||||
|             WidgetFactory.setARIALabel(button, tuple._2); | ||||
|             this.radioButtons.put(tuple._1, button); | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -29,11 +29,14 @@ public final class SingleSelection extends Combo implements Selection { | |||
|     final List<String> keyMapping; | ||||
|     final boolean isEditable; | ||||
| 
 | ||||
|     SingleSelection(final Composite parent, final int type) { | ||||
|     SingleSelection(final Composite parent, final int type, final String testKey) { | ||||
|         super(parent, type); | ||||
|         this.valueMapping = new ArrayList<>(); | ||||
|         this.keyMapping = new ArrayList<>(); | ||||
|         this.isEditable = type == SWT.NONE; | ||||
|         if (testKey != null) { | ||||
|             WidgetFactory.setTestId(this, testKey); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  |  | |||
|  | @ -67,7 +67,7 @@ public class WidgetFactory { | |||
| 
 | ||||
|     private static final String ADD_HTML_ATTR_ARIA_ROLE = "role"; | ||||
|     private static final String ADD_HTML_ATTR_ARIA_LABEL = "aria-label"; | ||||
|     private static final String ADD_HTML_ATTR_TEST_ID = "test-id"; | ||||
|     private static final String ADD_HTML_ATTR_TEST_ID = "data-test"; | ||||
|     private static final String SUB_TITLE_TExT_SUFFIX = ".subtitle"; | ||||
| 
 | ||||
|     public enum AriaRole { | ||||
|  | @ -377,6 +377,7 @@ public class WidgetFactory { | |||
|     public Button buttonLocalized(final Composite parent, final String locTextKey) { | ||||
|         final Button button = new Button(parent, SWT.NONE); | ||||
|         setARIARole(button, AriaRole.button); | ||||
|         setTestId(button, locTextKey); | ||||
|         this.polyglotPageService.injectI18n(button, new LocTextKey(locTextKey)); | ||||
|         return button; | ||||
|     } | ||||
|  | @ -384,6 +385,7 @@ public class WidgetFactory { | |||
|     public Button buttonLocalized(final Composite parent, final LocTextKey locTextKey) { | ||||
|         final Button button = new Button(parent, SWT.NONE); | ||||
|         setARIARole(button, AriaRole.button); | ||||
|         setTestId(button, locTextKey.name); | ||||
|         this.polyglotPageService.injectI18n(button, locTextKey); | ||||
|         return button; | ||||
|     } | ||||
|  | @ -391,6 +393,7 @@ public class WidgetFactory { | |||
|     public Button buttonLocalized(final Composite parent, final CustomVariant variant, final String locTextKey) { | ||||
|         final Button button = new Button(parent, SWT.NONE); | ||||
|         setARIARole(button, AriaRole.button); | ||||
|         setTestId(button, locTextKey); | ||||
|         this.polyglotPageService.injectI18n(button, new LocTextKey(locTextKey)); | ||||
|         button.setData(RWT.CUSTOM_VARIANT, variant.key); | ||||
|         return button; | ||||
|  | @ -408,6 +411,31 @@ public class WidgetFactory { | |||
|         if (ariaLabel != null) { | ||||
|             setARIALabel(button, this.i18nSupport.getText(ariaLabel)); | ||||
|         } | ||||
|         if (locTextKey != null) { | ||||
|             setTestId(button, locTextKey.name); | ||||
|         } else if (toolTipKey != null) { | ||||
|             setTestId(button, toolTipKey.name); | ||||
|         } | ||||
|         this.polyglotPageService.injectI18n(button, locTextKey, toolTipKey); | ||||
|         return button; | ||||
|     } | ||||
| 
 | ||||
|     public Button buttonLocalized( | ||||
|             final Composite parent, | ||||
|             final int type, | ||||
|             final LocTextKey locTextKey, | ||||
|             final LocTextKey toolTipKey, | ||||
|             final String testKey, | ||||
|             final LocTextKey ariaLabel) { | ||||
| 
 | ||||
|         final Button button = new Button(parent, type); | ||||
|         setARIARole(button, AriaRole.button); | ||||
|         if (ariaLabel != null) { | ||||
|             setARIALabel(button, this.i18nSupport.getText(ariaLabel)); | ||||
|         } | ||||
|         if (testKey != null) { | ||||
|             setTestId(button, testKey); | ||||
|         } | ||||
|         this.polyglotPageService.injectI18n(button, locTextKey, toolTipKey); | ||||
|         return button; | ||||
|     } | ||||
|  | @ -475,19 +503,23 @@ public class WidgetFactory { | |||
|     } | ||||
| 
 | ||||
|     public Text textInput(final Composite content, final LocTextKey label) { | ||||
|         return textInput(content, false, false, this.i18nSupport.getText(label)); | ||||
|         return textInput(content, false, false, label.name, this.i18nSupport.getText(label)); | ||||
|     } | ||||
| 
 | ||||
|     public Text textInput(final Composite content, final String label) { | ||||
|         return textInput(content, false, false, label); | ||||
|     public Text textInput(final Composite content, final String testKey, final LocTextKey label) { | ||||
|         return textInput(content, false, false, testKey, this.i18nSupport.getText(label)); | ||||
|     } | ||||
| 
 | ||||
|     public Text textInput(final Composite content, final String testKey, final String label) { | ||||
|         return textInput(content, false, false, testKey, label); | ||||
|     } | ||||
| 
 | ||||
|     public Text passwordInput(final Composite content, final LocTextKey label) { | ||||
|         return textInput(content, true, false, this.i18nSupport.getText(label)); | ||||
|         return textInput(content, true, false, label.name, this.i18nSupport.getText(label)); | ||||
|     } | ||||
| 
 | ||||
|     public Text passwordInput(final Composite content, final String label) { | ||||
|         return textInput(content, true, false, label); | ||||
|     public Text passwordInput(final Composite content, final String testKey, final String label) { | ||||
|         return textInput(content, true, false, testKey, label); | ||||
|     } | ||||
| 
 | ||||
|     public Text textAreaInput( | ||||
|  | @ -518,13 +550,14 @@ public class WidgetFactory { | |||
|             final boolean readonly, | ||||
|             final LocTextKey label) { | ||||
| 
 | ||||
|         return textInput(content, password, readonly, this.i18nSupport.getText(label)); | ||||
|         return textInput(content, password, readonly, label.name, this.i18nSupport.getText(label)); | ||||
|     } | ||||
| 
 | ||||
|     public Text textInput( | ||||
|             final Composite content, | ||||
|             final boolean password, | ||||
|             final boolean readonly, | ||||
|             final String testKey, | ||||
|             final String label) { | ||||
| 
 | ||||
|         final Text input = readonly | ||||
|  | @ -536,6 +569,9 @@ public class WidgetFactory { | |||
|         if (label != null) { | ||||
|             WidgetFactory.setARIALabel(input, label); | ||||
|         } | ||||
|         if (testKey != null) { | ||||
|             setTestId(input, testKey); | ||||
|         } | ||||
|         return input; | ||||
|     } | ||||
| 
 | ||||
|  | @ -552,6 +588,7 @@ public class WidgetFactory { | |||
|         final Text numberInput = new Text(content, (readonly) ? SWT.LEFT | SWT.READ_ONLY : SWT.RIGHT | SWT.BORDER); | ||||
|         if (label != null) { | ||||
|             setARIALabel(numberInput, this.i18nSupport.getText(label)); | ||||
|             setTestId(numberInput, label.name); | ||||
|         } | ||||
|         if (numberCheck != null) { | ||||
|             numberInput.addListener(SWT.Verify, event -> { | ||||
|  | @ -663,6 +700,7 @@ public class WidgetFactory { | |||
|         final TreeItem item = new TreeItem(parent, SWT.NONE); | ||||
|         this.polyglotPageService.injectI18n(item, new LocTextKey(locTextKey)); | ||||
|         setARIARole(item, AriaRole.listitem); | ||||
|         setTestId(item, locTextKey); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|  | @ -670,6 +708,7 @@ public class WidgetFactory { | |||
|         final TreeItem item = new TreeItem(parent, SWT.NONE); | ||||
|         this.polyglotPageService.injectI18n(item, locTextKey); | ||||
|         setARIARole(item, AriaRole.listitem); | ||||
|         setTestId(item, locTextKey.name); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|  | @ -677,6 +716,7 @@ public class WidgetFactory { | |||
|         final TreeItem item = new TreeItem(parent, SWT.NONE); | ||||
|         this.polyglotPageService.injectI18n(item, new LocTextKey(locTextKey)); | ||||
|         setARIARole(item, AriaRole.listitem); | ||||
|         setTestId(item, locTextKey); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|  | @ -684,6 +724,7 @@ public class WidgetFactory { | |||
|         final TreeItem item = new TreeItem(parent, SWT.NONE); | ||||
|         this.polyglotPageService.injectI18n(item, locTextKey); | ||||
|         setARIARole(item, AriaRole.listitem); | ||||
|         setTestId(item, locTextKey.name); | ||||
|         return item; | ||||
|     } | ||||
| 
 | ||||
|  | @ -774,112 +815,46 @@ public class WidgetFactory { | |||
|         if (toolTip != null) { | ||||
|             setARIALabel(imageButton, this.i18nSupport.getText(toolTip)); | ||||
|         } | ||||
|         setTestId(imageButton, toolTip.name); | ||||
|         return imageButton; | ||||
|     } | ||||
| 
 | ||||
|     public Selection selectionLocalized( | ||||
|             final Selection.Type type, | ||||
|             final Composite parent, | ||||
|             final Supplier<List<Tuple<String>>> itemsSupplier, | ||||
|             final LocTextKey label) { | ||||
| 
 | ||||
|         return this.selectionLocalized(type, parent, itemsSupplier, null, null, label); | ||||
|     } | ||||
| 
 | ||||
|     public Selection selectionLocalized( | ||||
|             final Selection.Type type, | ||||
|             final Composite parent, | ||||
|             final Supplier<List<Tuple<String>>> itemsSupplier, | ||||
|             final String label) { | ||||
| 
 | ||||
|         return this.selectionLocalized( | ||||
|                 type, parent, itemsSupplier, null, null, label); | ||||
|     } | ||||
| 
 | ||||
|     public Selection selectionLocalized( | ||||
|             final Selection.Type type, | ||||
|             final Composite parent, | ||||
|             final Supplier<List<Tuple<String>>> itemsSupplier, | ||||
|             final LocTextKey toolTipTextKey, | ||||
|             final LocTextKey label) { | ||||
| 
 | ||||
|         return this.selectionLocalized(type, parent, itemsSupplier, toolTipTextKey, null, label); | ||||
|     } | ||||
| 
 | ||||
|     public Selection selectionLocalized( | ||||
|             final Selection.Type type, | ||||
|             final Composite parent, | ||||
|             final Supplier<List<Tuple<String>>> itemsSupplier, | ||||
|             final LocTextKey toolTipTextKey, | ||||
|             final Supplier<List<Tuple<String>>> itemsToolTipSupplier, | ||||
|             final String label) { | ||||
| 
 | ||||
|         return selectionLocalized( | ||||
|                 type, parent, itemsSupplier, toolTipTextKey, itemsToolTipSupplier, null, label); | ||||
|     } | ||||
| 
 | ||||
|     public Selection selectionLocalized( | ||||
|             final Selection.Type type, | ||||
|             final Composite parent, | ||||
|             final Supplier<List<Tuple<String>>> itemsSupplier, | ||||
|             final LocTextKey toolTipTextKey, | ||||
|             final Supplier<List<Tuple<String>>> itemsToolTipSupplier, | ||||
|             final LocTextKey label) { | ||||
| 
 | ||||
|         return selectionLocalized( | ||||
|                 type, parent, itemsSupplier, toolTipTextKey, itemsToolTipSupplier, null, | ||||
|                 (label != null) ? this.i18nSupport.getText(label) : null); | ||||
|     } | ||||
| 
 | ||||
|     public Selection selectionLocalized( | ||||
|             final Selection.Type type, | ||||
|             final Composite parent, | ||||
|             final Supplier<List<Tuple<String>>> itemsSupplier, | ||||
|             final LocTextKey toolTipTextKey, | ||||
|             final Supplier<List<Tuple<String>>> itemsToolTipSupplier, | ||||
|             final String actionLocTextPrefix, | ||||
|             final LocTextKey label) { | ||||
|         return selectionLocalized( | ||||
|                 type, parent, itemsSupplier, toolTipTextKey, itemsToolTipSupplier, actionLocTextPrefix, | ||||
|                 (label != null) ? this.i18nSupport.getText(label) : null); | ||||
|     } | ||||
| 
 | ||||
|     public Selection selectionLocalized( | ||||
|             final Selection.Type type, | ||||
|             final Composite parent, | ||||
|             final Supplier<List<Tuple<String>>> itemsSupplier, | ||||
|             final LocTextKey toolTipTextKey, | ||||
|             final Supplier<List<Tuple<String>>> itemsToolTipSupplier, | ||||
|             final String actionLocTextPrefix, | ||||
|             final String label) { | ||||
|             final String testKey, | ||||
|             final String ariaLabel) { | ||||
| 
 | ||||
|         final Selection selection; | ||||
|         switch (type) { | ||||
|             case SINGLE: | ||||
|                 selection = new SingleSelection(parent, SWT.READ_ONLY); | ||||
|                 selection = new SingleSelection(parent, SWT.READ_ONLY, testKey); | ||||
|                 break; | ||||
|             case SINGLE_COMBO: | ||||
|                 selection = new SingleSelection(parent, SWT.NONE); | ||||
|                 selection = new SingleSelection(parent, SWT.NONE, testKey); | ||||
|                 break; | ||||
|             case RADIO: | ||||
|                 selection = new RadioSelection(parent); | ||||
|                 selection = new RadioSelection(parent, testKey); | ||||
|                 break; | ||||
|             case MULTI: | ||||
|                 selection = new MultiSelection(parent); | ||||
|                 selection = new MultiSelection(parent, testKey); | ||||
|                 break; | ||||
|             case MULTI_COMBO: | ||||
|                 selection = new MultiSelectionCombo( | ||||
|                         parent, | ||||
|                         this, | ||||
|                         actionLocTextPrefix, | ||||
|                         testKey, | ||||
|                         // NOTE parent would work for firefox but on IE and Chrome only parent.getParent().getParent() works | ||||
|                         parent.getParent().getParent()); | ||||
|                 break; | ||||
|             case MULTI_CHECKBOX: | ||||
|                 selection = new MultiSelectionCheckbox(parent); | ||||
|                 selection = new MultiSelectionCheckbox(parent, testKey); | ||||
|                 break; | ||||
|             case COLOR: | ||||
|                 selection = new ColorSelection(parent, this, actionLocTextPrefix); | ||||
|                 selection = new ColorSelection(parent, this, testKey); | ||||
|                 break; | ||||
|             default: | ||||
|                 throw new IllegalArgumentException("Unsupported Selection.Type: " + type); | ||||
|  | @ -903,41 +878,53 @@ public class WidgetFactory { | |||
|             updateFunction.accept(selection); | ||||
|         } | ||||
| 
 | ||||
|         if (label != null) { | ||||
|             selection.setAriaLabel(label); | ||||
|         if (ariaLabel != null) { | ||||
|             selection.setAriaLabel(ariaLabel); | ||||
|         } | ||||
| 
 | ||||
|         return selection; | ||||
|     } | ||||
| 
 | ||||
|     public DateTime dateSelector(final Composite parent, final LocTextKey label) { | ||||
|     public DateTime dateSelector(final Composite parent, final LocTextKey label, final String testKey) { | ||||
|         RWT.setLocale(this.i18nSupport.getUsersFormatLocale()); | ||||
|         final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); | ||||
|         final DateTime dateTime = new DateTime(parent, SWT.DATE | SWT.BORDER | SWT.DROP_DOWN); | ||||
|         dateTime.setLayoutData(gridData); | ||||
| 
 | ||||
|         if (label != null) { | ||||
|             setARIALabel(dateTime, this.i18nSupport.getText(label)); | ||||
|         } | ||||
|         if (testKey != null) { | ||||
|             setTestId(dateTime, testKey); | ||||
|         } | ||||
|         return dateTime; | ||||
|     } | ||||
| 
 | ||||
|     public DateTime timeSelector(final Composite parent, final LocTextKey label) { | ||||
|     public DateTime timeSelector(final Composite parent, final LocTextKey label, final String testKey) { | ||||
|         final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); | ||||
|         final DateTime dateTime = new DateTime(parent, SWT.TIME | SWT.BORDER | SWT.SHORT); | ||||
|         dateTime.setLayoutData(gridData); | ||||
| 
 | ||||
|         if (label != null) { | ||||
|             setARIALabel(dateTime, this.i18nSupport.getText(label)); | ||||
|         } | ||||
|         if (testKey != null) { | ||||
|             setTestId(dateTime, testKey); | ||||
|         } | ||||
|         return dateTime; | ||||
|     } | ||||
| 
 | ||||
|     public DateTime timeSelectorWithSeconds(final Composite parent, final LocTextKey label) { | ||||
|     public DateTime timeSelectorWithSeconds(final Composite parent, final LocTextKey label, final String testKey) { | ||||
|         final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); | ||||
|         final DateTime dateTime = new DateTime(parent, SWT.TIME | SWT.BORDER | SWT.MEDIUM); | ||||
|         dateTime.setLayoutData(gridData); | ||||
| 
 | ||||
|         if (label != null) { | ||||
|             setARIALabel(dateTime, this.i18nSupport.getText(label)); | ||||
|         } | ||||
|         if (testKey != null) { | ||||
|             setTestId(dateTime, testKey); | ||||
|         } | ||||
|         return dateTime; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1748,7 +1748,7 @@ sebserver.monitoring.exam.proctoring.action.broadcastoff.video=End Video Broadca | |||
| sebserver.monitoring.exam.proctoring.action.broadcaston.chat=Enable Chat | ||||
| sebserver.monitoring.exam.proctoring.action.broadcastoff.chat=Disable Chat | ||||
| sebserver.monitoring.exam.proctoring.room.connections.title=SEB Connections in {0} | ||||
| 
 | ||||
| sebserver.monitoring.exam.proctoring.room.connections.joinurl=Join URL:  | ||||
| 
 | ||||
| sebserver.monitoring.exam.info.pleaseSelect=At first please select an Exam from the list | ||||
| sebserver.monitoring.exam.list.empty=There are currently no running exams | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 anhefti
						anhefti