added tooltips for input fields in forms
This commit is contained in:
		
							parent
							
								
									7238369550
								
							
						
					
					
						commit
						7c092d6e12
					
				
					 17 changed files with 204 additions and 132 deletions
				
			
		|  | @ -82,7 +82,7 @@ public class SebClientConfigForm implements TemplateComposer { | |||
|     private static final LocTextKey FALLBACK_PASSWORD_TEXT_KEY = | ||||
|             new LocTextKey("sebserver.clientconfig.form.sebServerFallbackPasswordHash"); | ||||
|     private static final LocTextKey FALLBACK_PASSWORD_CONFIRM_TEXT_KEY = | ||||
|             new LocTextKey("sebserver.clientconfig.form.sebServerFallbackPasswordHash"); | ||||
|             new LocTextKey("sebserver.clientconfig.form.sebServerFallbackPasswordHash.confirm"); | ||||
|     private static final LocTextKey QUIT_PASSWORD_TEXT_KEY = | ||||
|             new LocTextKey("sebserver.clientconfig.form.hashedQuitPassword"); | ||||
|     private static final LocTextKey QUIT_PASSWORD_CONFIRM_TEXT_KEY = | ||||
|  | @ -314,7 +314,14 @@ public class SebClientConfigForm implements TemplateComposer { | |||
|                 .addListener(SWT.Selection, event -> { | ||||
|                     formHandle.process( | ||||
|                             FALLBACK_ATTRIBUTES::contains, | ||||
|                             ffa -> ffa.setVisible(((Button) event.widget).getSelection()) | ||||
|                             ffa -> { | ||||
|                                 boolean selected = ((Button) event.widget).getSelection(); | ||||
|                                 ffa.setVisible(selected); | ||||
|                                 if (!selected && ffa.hasError()) { | ||||
|                                     ffa.resetError(); | ||||
|                                     ffa.setStringValue(StringUtils.EMPTY); | ||||
|                                 } | ||||
|                             } | ||||
|                     ); | ||||
|                 }); | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,17 +8,14 @@ | |||
| 
 | ||||
| package ch.ethz.seb.sebserver.gui.form; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; | ||||
| import ch.ethz.seb.sebserver.gui.service.page.PageService; | ||||
| import org.apache.commons.lang3.BooleanUtils; | ||||
| import org.eclipse.swt.SWT; | ||||
| import org.eclipse.swt.layout.GridData; | ||||
| import org.eclipse.swt.widgets.Button; | ||||
| import org.eclipse.swt.widgets.Composite; | ||||
| import org.eclipse.swt.widgets.Control; | ||||
| import org.eclipse.swt.widgets.Label; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; | ||||
| 
 | ||||
| import java.util.function.Consumer; | ||||
| 
 | ||||
| public class CheckboxFieldBuilder extends FieldBuilder<String> { | ||||
| 
 | ||||
|  | @ -48,6 +45,11 @@ public class CheckboxFieldBuilder extends FieldBuilder<String> { | |||
|             checkbox.setEnabled(false); | ||||
|         } | ||||
| 
 | ||||
|         if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) { | ||||
|             builder.pageService.getPolyglotPageService().injectI18nTooltip( | ||||
|                     checkbox, this.tooltip); | ||||
|         } | ||||
| 
 | ||||
|         builder.form.putField(this.name, titleLabel, checkbox); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ package ch.ethz.seb.sebserver.gui.form; | |||
| 
 | ||||
| import java.util.function.BooleanSupplier; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gui.service.page.PageService; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.eclipse.rap.rwt.RWT; | ||||
| import org.eclipse.swt.SWT; | ||||
|  | @ -27,8 +28,6 @@ public abstract class FieldBuilder<T> { | |||
| 
 | ||||
|     public static final LocTextKey MANDATORY_TEXT_KEY = new LocTextKey("sebserver.form.mandatory"); | ||||
|     public static final String TOOLTIP_KEY_SUFFIX_LABEL = ".tooltip"; | ||||
|     public static final String TOOLTIP_KEY_SUFFIX_LEFT = ".tooltip.left"; | ||||
|     public static final String TOOLTIP_KEY_SUFFIX_RIGHT = ".tooltip.right"; | ||||
| 
 | ||||
|     int spanLabel = -1; | ||||
|     int spanInput = -1; | ||||
|  | @ -43,18 +42,14 @@ public abstract class FieldBuilder<T> { | |||
| 
 | ||||
|     final String name; | ||||
|     final LocTextKey label; | ||||
|     final LocTextKey tooltipLabel; | ||||
|     final LocTextKey tooltipKeyLeft; | ||||
|     final LocTextKey tooltipKeyRight; | ||||
|     final LocTextKey tooltip; | ||||
|     final T value; | ||||
| 
 | ||||
|     protected FieldBuilder(final String name, final LocTextKey label, final T value) { | ||||
|         this.name = name; | ||||
|         this.label = label; | ||||
|         this.value = value; | ||||
|         this.tooltipLabel = (label != null) ? new LocTextKey(label.name + TOOLTIP_KEY_SUFFIX_LABEL) : null; | ||||
|         this.tooltipKeyLeft = (label != null) ? new LocTextKey(label.name + TOOLTIP_KEY_SUFFIX_LEFT) : null; | ||||
|         this.tooltipKeyRight = (label != null) ? new LocTextKey(label.name + TOOLTIP_KEY_SUFFIX_RIGHT) : null; | ||||
|         this.tooltip = (label != null) ? new LocTextKey(label.name + TOOLTIP_KEY_SUFFIX_LABEL) : null; | ||||
|     } | ||||
| 
 | ||||
|     public FieldBuilder<T> withDefaultLabel(final String defaultLabel) { | ||||
|  | @ -134,28 +129,36 @@ public abstract class FieldBuilder<T> { | |||
|         gridData.horizontalSpan = (fieldBuilder.spanLabel > 0) ? fieldBuilder.spanLabel : 1; | ||||
|         infoGrid.setLayoutData(gridData); | ||||
| 
 | ||||
|         if (fieldBuilder.tooltipKeyLeft != null && | ||||
|                 StringUtils.isNotBlank(builder.i18nSupport.getText(fieldBuilder.tooltipKeyLeft, ""))) { | ||||
| 
 | ||||
|             final Label info = builder.widgetFactory.imageButton( | ||||
|                     WidgetFactory.ImageIcon.HELP, | ||||
|                     infoGrid, | ||||
|                     fieldBuilder.tooltipKeyLeft); | ||||
|             info.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); | ||||
|         } | ||||
| 
 | ||||
|         final boolean hasLabelTooltip = (fieldBuilder.tooltipLabel != null && | ||||
|                 StringUtils.isNotBlank(builder.i18nSupport.getText(fieldBuilder.tooltipLabel, ""))); | ||||
|         final boolean hasTooltip = (fieldBuilder.tooltip != null && | ||||
|                 StringUtils.isNotBlank(builder.i18nSupport.getText(fieldBuilder.tooltip, ""))); | ||||
| 
 | ||||
|         final Label label = labelLocalized( | ||||
|                 builder.widgetFactory, | ||||
|                 infoGrid, | ||||
|                 fieldBuilder.label, | ||||
|                 fieldBuilder.defaultLabel, | ||||
|                 (hasLabelTooltip) ? fieldBuilder.tooltipLabel : null, | ||||
|                 (hasTooltip) ? fieldBuilder.tooltip : null, | ||||
|                 1, | ||||
|                 fieldBuilder.titleValign); | ||||
| 
 | ||||
|         if (hasTooltip && builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.LEFT) { | ||||
|             final Label info = builder.widgetFactory.imageButton( | ||||
|                     WidgetFactory.ImageIcon.HELP, | ||||
|                     infoGrid, | ||||
|                     fieldBuilder.tooltip); | ||||
|             info.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); | ||||
|         } | ||||
| 
 | ||||
| //        if (fieldBuilder.tooltipKeyRight != null && | ||||
| //                StringUtils.isNotBlank(builder.i18nSupport.getText(fieldBuilder.tooltipKeyRight, ""))) { | ||||
| // | ||||
| //            final Label info = builder.widgetFactory.imageButton( | ||||
| //                    WidgetFactory.ImageIcon.HELP, | ||||
| //                    infoGrid, | ||||
| //                    fieldBuilder.tooltipKeyRight); | ||||
| //            info.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); | ||||
| //        } | ||||
| 
 | ||||
|         if (fieldBuilder.isMandatory) { | ||||
|             final Label mandatory = builder.widgetFactory.imageButton( | ||||
|                     WidgetFactory.ImageIcon.MANDATORY, | ||||
|  | @ -164,16 +167,6 @@ public abstract class FieldBuilder<T> { | |||
|             mandatory.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); | ||||
|         } | ||||
| 
 | ||||
|         if (fieldBuilder.tooltipKeyRight != null && | ||||
|                 StringUtils.isNotBlank(builder.i18nSupport.getText(fieldBuilder.tooltipKeyRight, ""))) { | ||||
| 
 | ||||
|             final Label info = builder.widgetFactory.imageButton( | ||||
|                     WidgetFactory.ImageIcon.HELP, | ||||
|                     infoGrid, | ||||
|                     fieldBuilder.tooltipKeyRight); | ||||
|             info.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); | ||||
|         } | ||||
| 
 | ||||
|         return infoGrid; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ package ch.ethz.seb.sebserver.gui.form; | |||
| 
 | ||||
| import java.util.Collection; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gui.service.page.PageService; | ||||
| import org.eclipse.swt.SWT; | ||||
| import org.eclipse.swt.layout.GridData; | ||||
| import org.eclipse.swt.widgets.Composite; | ||||
|  | @ -48,6 +49,11 @@ public class FileUploadFieldBuilder extends FieldBuilder<String> { | |||
|         final Label errorLabel = createErrorLabel(fieldGrid); | ||||
|         builder.form.putField(this.name, titleLabel, fileUpload, errorLabel); | ||||
|         builder.setFieldVisible(this.visible, this.name); | ||||
| 
 | ||||
|         if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) { | ||||
|             builder.pageService.getPolyglotPageService().injectI18nTooltip( | ||||
|                     fileUpload, this.tooltip); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -512,6 +512,10 @@ public final class Form implements FormBinding { | |||
|             this.jsonValueAdapter.accept(new Tuple<>(key, getStringValue()), objectRoot); | ||||
|         } | ||||
| 
 | ||||
|         public boolean hasError() { | ||||
|             return this.hasError; | ||||
|         } | ||||
| 
 | ||||
|         public void setError(final String errorMessage) { | ||||
|             if (this.errorLabel == null) { | ||||
|                 return; | ||||
|  |  | |||
|  | @ -101,7 +101,7 @@ public class FormHandle<T extends Entity> { | |||
|         // reset all errors that may still be displayed | ||||
|         this.form.process( | ||||
|                 Utils.truePredicate(), | ||||
|                 fieldAccessor -> fieldAccessor.resetError()); | ||||
|                 FormFieldAccessor::resetError); | ||||
| 
 | ||||
|         // post | ||||
|         return this.post | ||||
|  | @ -165,10 +165,11 @@ public class FormHandle<T extends Entity> { | |||
|         return this.form.hasAnyError(); | ||||
|     } | ||||
| 
 | ||||
|     private final void showValidationError( | ||||
|     private void showValidationError( | ||||
|             final FormFieldAccessor fieldAccessor, | ||||
|             final FieldValidationError valError) { | ||||
| 
 | ||||
|         //noinspection RedundantCast | ||||
|         fieldAccessor.setError(this.i18nSupport.getText(new LocTextKey( | ||||
|                 FIELD_VALIDATION_LOCTEXT_PREFIX + valError.errorType, | ||||
|                 (Object[]) valError.getAttributes()))); | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| 
 | ||||
| package ch.ethz.seb.sebserver.gui.form; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gui.service.page.PageService; | ||||
| import org.eclipse.swt.SWT; | ||||
| import org.eclipse.swt.layout.GridData; | ||||
| import org.eclipse.swt.widgets.Composite; | ||||
|  | @ -53,6 +54,11 @@ public final class ImageUploadFieldBuilder extends FieldBuilder<String> { | |||
|         final Label errorLabel = createErrorLabel(fieldGrid); | ||||
|         builder.form.putField(this.name, titleLabel, imageUpload, errorLabel); | ||||
|         builder.setFieldVisible(this.visible, this.name); | ||||
| 
 | ||||
|         if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) { | ||||
|             builder.pageService.getPolyglotPageService().injectI18nTooltip( | ||||
|                     imageUpload, this.tooltip); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -9,6 +9,7 @@ | |||
| package ch.ethz.seb.sebserver.gui.form; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; | ||||
| import ch.ethz.seb.sebserver.gui.service.page.PageService; | ||||
| import ch.ethz.seb.sebserver.gui.widget.PasswordInput; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.eclipse.swt.widgets.Composite; | ||||
|  | @ -33,6 +34,11 @@ public class PasswordFieldBuilder extends FieldBuilder<CharSequence> { | |||
|                 ? builder.cryptor.decrypt(this.value) | ||||
|                 : this.value); | ||||
| 
 | ||||
|         if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) { | ||||
|             builder.pageService.getPolyglotPageService().injectI18nTooltip( | ||||
|                     input, this.tooltip); | ||||
|         } | ||||
| 
 | ||||
|         final Label errorLabel = createErrorLabel(fieldGrid); | ||||
|         builder.form.putField(this.name, titleLabel, input, errorLabel); | ||||
|     } | ||||
|  |  | |||
|  | @ -14,6 +14,7 @@ import java.util.List; | |||
| import java.util.function.Consumer; | ||||
| import java.util.function.Supplier; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gui.service.page.PageService; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.eclipse.swt.SWT; | ||||
| import org.eclipse.swt.layout.GridData; | ||||
|  | @ -72,7 +73,7 @@ public final class SelectionFieldBuilder extends FieldBuilder<String> { | |||
|                 this.type, | ||||
|                 fieldGrid, | ||||
|                 this.itemsSupplier, | ||||
|                 null, | ||||
|                 (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) ? tooltip : null, | ||||
|                 null, | ||||
|                 actionKey); | ||||
| 
 | ||||
|  | @ -84,9 +85,7 @@ public final class SelectionFieldBuilder extends FieldBuilder<String> { | |||
|         builder.form.putField(this.name, titleLabel, selection, errorLabel); | ||||
| 
 | ||||
|         if (this.selectionListener != null) { | ||||
|             ((Control) selection).addListener(SWT.Selection, e -> { | ||||
|                 this.selectionListener.accept(builder.form); | ||||
|             }); | ||||
|             ((Control) selection).addListener(SWT.Selection, e -> this.selectionListener.accept(builder.form)); | ||||
|         } | ||||
| 
 | ||||
|         builder.setFieldVisible(this.visible, this.name); | ||||
|  | @ -97,7 +96,6 @@ public final class SelectionFieldBuilder extends FieldBuilder<String> { | |||
|         if (this.type == Type.MULTI || this.type == Type.MULTI_COMBO || this.type == Type.MULTI_CHECKBOX) { | ||||
|             final Composite composite = new Composite(builder.formParent, SWT.NONE); | ||||
|             final GridLayout gridLayout = new GridLayout(1, true); | ||||
|             //gridLayout.verticalSpacing = 5; | ||||
|             gridLayout.marginBottom = 5; | ||||
|             gridLayout.horizontalSpacing = 0; | ||||
|             gridLayout.marginLeft = 0; | ||||
|  | @ -117,18 +115,23 @@ public final class SelectionFieldBuilder extends FieldBuilder<String> { | |||
|                         .stream() | ||||
|                         .filter(tuple -> keys.contains(tuple._1)) | ||||
|                         .map(tuple -> tuple._1) | ||||
|                         .forEach(v -> buildReadonlyLabel(composite, v, 1)); | ||||
|                         .forEach(v -> buildReadonlyLabel(builder, composite, v, 1)); | ||||
|             } | ||||
|         } else { | ||||
|             builder.form.putReadonlyField( | ||||
|                     this.name, | ||||
|                     titleLabel, | ||||
|                     buildReadonlyLabel(builder.formParent, this.value, this.spanInput)); | ||||
|                     buildReadonlyLabel(builder, builder.formParent, this.value, this.spanInput)); | ||||
|             builder.setFieldVisible(this.visible, this.name); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private Text buildReadonlyLabel(final Composite composite, final String valueKey, final int hspan) { | ||||
|     private Text buildReadonlyLabel( | ||||
|             final FormBuilder builder, | ||||
|             final Composite composite, | ||||
|             final String valueKey, | ||||
|             final int hspan) { | ||||
| 
 | ||||
|         final Text label = new Text(composite, SWT.READ_ONLY); | ||||
|         final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, true, hspan, 1); | ||||
|         gridData.verticalIndent = 0; | ||||
|  | @ -144,6 +147,11 @@ public final class SelectionFieldBuilder extends FieldBuilder<String> { | |||
| 
 | ||||
|         label.setText(valueSupplier.get()); | ||||
|         label.setData(PolyglotPageService.POLYGLOT_WIDGET_FUNCTION_KEY, updateFunction); | ||||
|         if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) { | ||||
|             builder.pageService.getPolyglotPageService().injectI18nTooltip( | ||||
|                     label, this.tooltip); | ||||
|         } | ||||
| 
 | ||||
|         return label; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ package ch.ethz.seb.sebserver.gui.form; | |||
| 
 | ||||
| import java.util.function.Consumer; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gui.service.page.PageService; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.eclipse.rap.rwt.RWT; | ||||
| import org.eclipse.swt.SWT; | ||||
|  | @ -104,6 +105,11 @@ public final class TextFieldBuilder extends FieldBuilder<String> { | |||
|                 browser.setText(Constants.EMPTY_NOTE); | ||||
|             } | ||||
|             builder.form.putReadonlyField(this.name, titleLabel, browser); | ||||
| 
 | ||||
|             if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) { | ||||
|                 builder.pageService.getPolyglotPageService().injectI18nTooltip( | ||||
|                         browser, this.tooltip); | ||||
|             } | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|  | @ -113,6 +119,11 @@ public final class TextFieldBuilder extends FieldBuilder<String> { | |||
|                         ? builder.widgetFactory.textAreaInput(fieldGrid, readonly) | ||||
|                         : builder.widgetFactory.textInput(fieldGrid, this.isPassword, readonly); | ||||
| 
 | ||||
|         if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) { | ||||
|             builder.pageService.getPolyglotPageService().injectI18nTooltip( | ||||
|                     textInput, this.tooltip); | ||||
|         } | ||||
| 
 | ||||
|         final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, true); | ||||
|         if (this.isArea) { | ||||
|             gridData.minimumHeight = this.areaMinHeight; | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ package ch.ethz.seb.sebserver.gui.form; | |||
| import java.util.Collection; | ||||
| import java.util.stream.Collectors; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gui.service.page.PageService; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.eclipse.swt.SWT; | ||||
| import org.eclipse.swt.layout.GridData; | ||||
|  | @ -67,11 +68,16 @@ public class ThresholdListBuilder extends FieldBuilder<Collection<Threshold>> { | |||
|             final Label errorLabel = createErrorLabel(fieldGrid); | ||||
|             builder.form.putField(this.name, titleLabel, thresholdList, errorLabel); | ||||
|             builder.setFieldVisible(this.visible, this.name); | ||||
| 
 | ||||
|             if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) { | ||||
|                 builder.pageService.getPolyglotPageService().injectI18nTooltip( | ||||
|                         thresholdList, this.tooltip); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     public static final String thresholdsToFormURLEncodedStringValue(final Collection<Threshold> thresholds) { | ||||
|     public static String thresholdsToFormURLEncodedStringValue(final Collection<Threshold> thresholds) { | ||||
|         if (thresholds == null || thresholds.isEmpty()) { | ||||
|             return null; | ||||
|         } | ||||
|  | @ -80,7 +86,7 @@ public class ThresholdListBuilder extends FieldBuilder<Collection<Threshold>> { | |||
|         return StringUtils.join(thresholds.stream() | ||||
|                 .map(t -> Domain.THRESHOLD.REFERENCE_NAME | ||||
|                         + Constants.FORM_URL_ENCODED_NAME_VALUE_SEPARATOR | ||||
|                         + String.valueOf(t.getValue()) | ||||
|                         + t.getValue() | ||||
|                         + Constants.EMBEDDED_LIST_SEPARATOR | ||||
|                         + t.getColor()) | ||||
|                 .collect(Collectors.toList()), | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ package ch.ethz.seb.sebserver.gui.service.i18n; | |||
| import java.util.Collection; | ||||
| import java.util.Locale; | ||||
| 
 | ||||
| import org.eclipse.swt.widgets.Text; | ||||
| import org.joda.time.DateTime; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gbl.util.Utils; | ||||
|  |  | |||
|  | @ -10,17 +10,7 @@ package ch.ethz.seb.sebserver.gui.service.i18n; | |||
| 
 | ||||
| import java.util.Locale; | ||||
| 
 | ||||
| import org.eclipse.swt.widgets.Button; | ||||
| import org.eclipse.swt.widgets.Composite; | ||||
| import org.eclipse.swt.widgets.Group; | ||||
| import org.eclipse.swt.widgets.Label; | ||||
| import org.eclipse.swt.widgets.TabFolder; | ||||
| import org.eclipse.swt.widgets.TabItem; | ||||
| import org.eclipse.swt.widgets.Table; | ||||
| import org.eclipse.swt.widgets.TableColumn; | ||||
| import org.eclipse.swt.widgets.TableItem; | ||||
| import org.eclipse.swt.widgets.Tree; | ||||
| import org.eclipse.swt.widgets.TreeItem; | ||||
| import org.eclipse.swt.widgets.*; | ||||
| 
 | ||||
| import ch.ethz.seb.sebserver.gui.service.page.PageContext; | ||||
| import ch.ethz.seb.sebserver.gui.widget.ImageUploadSelection; | ||||
|  | @ -75,6 +65,8 @@ public interface PolyglotPageService { | |||
| 
 | ||||
|     void injectI18n(TabItem tabItem, LocTextKey locTextKey, LocTextKey locTooltipKey); | ||||
| 
 | ||||
|     void injectI18nTooltip(Control control, LocTextKey locTooltipKey); | ||||
| 
 | ||||
|     void createLanguageSelector(PageContext composerCtx); | ||||
| 
 | ||||
| } | ||||
|  | @ -188,6 +188,18 @@ public final class PolyglotPageServiceImpl implements PolyglotPageService { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void injectI18nTooltip(Control control, LocTextKey locTooltipKey) { | ||||
|         if (locTooltipKey == null || control == null) { | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         if (this.i18nSupport.hasText(locTooltipKey) && StringUtils.isNotBlank(this.i18nSupport.getText(locTooltipKey, ""))) { | ||||
|             control.setData(POLYGLOT_ITEM_TOOLTIP_DATA_KEY, locTooltipKey); | ||||
|             control.setToolTipText(Utils.formatLineBreaks(this.i18nSupport.getText(locTooltipKey))); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void createLanguageSelector(final PageContext composerCtx) { | ||||
|         for (final Locale locale : this.i18nSupport.supportedLanguages()) { | ||||
|  |  | |||
|  | @ -58,6 +58,12 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; | |||
|  * with forms and tables as well as dealing with page actions */ | ||||
| public interface PageService { | ||||
| 
 | ||||
|     enum FormTooltipMode { | ||||
|         RIGHT, | ||||
|         INPUT, | ||||
|         LEFT, | ||||
|     } | ||||
| 
 | ||||
|     Logger log = LoggerFactory.getLogger(PageService.class); | ||||
| 
 | ||||
|     /** Get the WidgetFactory service | ||||
|  | @ -105,6 +111,11 @@ public interface PageService { | |||
|      * @return PageState of the current user. */ | ||||
|     PageState getCurrentState(); | ||||
| 
 | ||||
|     /** Get the configured tooltip mode for input forms | ||||
|      * | ||||
|      * @return the configured tooltip mode for input forms */ | ||||
|     FormTooltipMode getFormTooltipMode(); | ||||
| 
 | ||||
|     /** Get a PageAction function to go back to the current state. | ||||
|      * | ||||
|      * @return a PageAction function to go back to the current state. */ | ||||
|  |  | |||
|  | @ -162,6 +162,12 @@ public class PageServiceImpl implements PageService { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public FormTooltipMode getFormTooltipMode() { | ||||
|         // TODO make this configurable | ||||
|         return FormTooltipMode.INPUT; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     @SuppressWarnings("unchecked") | ||||
|     public <T extends PageEvent> void firePageEvent(final T event, final PageContext pageContext) { | ||||
|  |  | |||
|  | @ -236,7 +236,7 @@ sebserver.useraccount.form.language.tooltip=The users language. | |||
| sebserver.useraccount.form.timezone=Time Zone | ||||
| sebserver.useraccount.form.timezone.tooltip=The time-zone of the user.<br/><br/>Note that this also defines the exact time and date that is displayed to the user. | ||||
| sebserver.useraccount.form.roles=User Roles | ||||
| sebserver.useraccount.form.roles.tooltip=Select the roles for the user.<br/>A user can have more then one role but must have at least one.<br/><br/>Please use the tooltip on the role name for more information about a specific role. | ||||
| sebserver.useraccount.form.roles.tooltip=The roles of the user.<br/>A user can have more then one role but must have at least one.<br/><br/>In Edit mode, please use the tooltip on the role name for more information about a specific role. | ||||
| sebserver.useraccount.form.password=Password | ||||
| sebserver.useraccount.form.password.tooltip=The password of the user account | ||||
| sebserver.useraccount.form.password.confirm=Confirm Password | ||||
|  | @ -607,11 +607,11 @@ sebserver.clientconfig.form.sebServerFallbackAttemptInterval=Interval | |||
| sebserver.clientconfig.form.sebServerFallbackAttemptInterval.tooltip=The interval (in milli-seconds) between connection attempts a SEB client shall use. | ||||
| sebserver.clientconfig.form.sebServerFallbackPasswordHash=Fallback Password | ||||
| sebserver.clientconfig.form.sebServerFallbackPasswordHash.tooltip=A password if set a SEB Client user must provide before the SEB client starts the fallback procedure. | ||||
| sebserver.clientconfig.form.sebServerFallbackPasswordHash.confirm=Confirm Fallback Password | ||||
| sebserver.clientconfig.form.sebServerFallbackPasswordHash.confirm=Confirm Password | ||||
| sebserver.clientconfig.form.sebServerFallbackPasswordHash.tooltip.confirm=Please confirm the fallback password | ||||
| sebserver.clientconfig.form.hashedQuitPassword=Quit Password | ||||
| sebserver.clientconfig.form.hashedQuitPassword.tooltip=A password if set a SEB client user must provide to be able to quit the SEB client. | ||||
| sebserver.clientconfig.form.hashedQuitPassword.confirm=Confirm Quit Password | ||||
| sebserver.clientconfig.form.hashedQuitPassword.confirm=Confirm Password | ||||
| sebserver.clientconfig.form.hashedQuitPassword.tooltip.confirm=Please confirm the quit password | ||||
| 
 | ||||
| sebserver.clientconfig.form.date=Creation Date | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 anhefti
						anhefti