SEBSERV-138 fixed navigation and filter. Added more input field types
This commit is contained in:
parent
c3b999fc4c
commit
2dea3e2285
22 changed files with 263 additions and 117 deletions
|
@ -15,8 +15,8 @@ import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.SashForm;
|
import org.eclipse.swt.custom.SashForm;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Label;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
@ -96,12 +96,12 @@ public class MainPage implements TemplateComposer {
|
||||||
},
|
},
|
||||||
false);
|
false);
|
||||||
|
|
||||||
final Label toggleView = this.widgetFactory.imageButton(
|
final Button toggleView = this.widgetFactory.imageButton(
|
||||||
ImageIcon.MAXIMIZE,
|
ImageIcon.MAXIMIZE,
|
||||||
content,
|
content,
|
||||||
new LocTextKey("sebserver.mainpage.maximize.tooltip"),
|
new LocTextKey("sebserver.mainpage.maximize.tooltip"),
|
||||||
event -> {
|
event -> {
|
||||||
final Label ib = (Label) event.widget;
|
final Button ib = (Button) event.widget;
|
||||||
if ((Boolean) ib.getData("fullScreen")) {
|
if ((Boolean) ib.getData("fullScreen")) {
|
||||||
mainSash.setWeights(DEFAULT_SASH_WEIGHTS);
|
mainSash.setWeights(DEFAULT_SASH_WEIGHTS);
|
||||||
ib.setData("fullScreen", false);
|
ib.setData("fullScreen", false);
|
||||||
|
|
|
@ -16,6 +16,8 @@ import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Tree;
|
import org.eclipse.swt.widgets.Tree;
|
||||||
import org.eclipse.swt.widgets.TreeItem;
|
import org.eclipse.swt.widgets.TreeItem;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -44,6 +46,8 @@ import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant;
|
||||||
@Component
|
@Component
|
||||||
public class ActivitiesPane implements TemplateComposer {
|
public class ActivitiesPane implements TemplateComposer {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(ActivitiesPane.class);
|
||||||
|
|
||||||
private static final String SKIP_EXPAND = "SKIP_EXPAND";
|
private static final String SKIP_EXPAND = "SKIP_EXPAND";
|
||||||
|
|
||||||
private static final String ATTR_ACTIVITY_SELECTION = "ACTIVITY_SELECTION";
|
private static final String ATTR_ACTIVITY_SELECTION = "ACTIVITY_SELECTION";
|
||||||
|
@ -361,7 +365,12 @@ public class ActivitiesPane implements TemplateComposer {
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// register page listener and initialize navigation data
|
// register page listener and initialize navigation data
|
||||||
navigation.addListener(SWT.Selection, event -> handleSelection(pageContext, event));
|
navigation.addListener(SWT.MouseUp, event -> handleSelection(pageContext, event));
|
||||||
|
navigation.addListener(SWT.KeyDown, event -> {
|
||||||
|
if (event.keyCode == 13 || event.keyCode == 32) {
|
||||||
|
handleSelection(pageContext, event);
|
||||||
|
}
|
||||||
|
});
|
||||||
navigation.addListener(SWT.Expand, event -> {
|
navigation.addListener(SWT.Expand, event -> {
|
||||||
final TreeItem item = (TreeItem) event.item;
|
final TreeItem item = (TreeItem) event.item;
|
||||||
selectCurrentItem(navigation, item);
|
selectCurrentItem(navigation, item);
|
||||||
|
@ -406,69 +415,83 @@ public class ActivitiesPane implements TemplateComposer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private TreeItem getDefaultSelectionFor(final Tree navigation, final CurrentUser currentUser2) {
|
private TreeItem getDefaultSelectionFor(final Tree navigation, final CurrentUser currentUser2) {
|
||||||
if (this.currentUser.get().hasAnyRole(UserRole.SEB_SERVER_ADMIN, UserRole.INSTITUTIONAL_ADMIN)) {
|
try {
|
||||||
return navigation.getItem(0);
|
if (this.currentUser.get().hasAnyRole(UserRole.SEB_SERVER_ADMIN, UserRole.INSTITUTIONAL_ADMIN)) {
|
||||||
} else if (this.currentUser.get().hasAnyRole(UserRole.EXAM_ADMIN)) {
|
return navigation.getItem(0);
|
||||||
return findItemByActionDefinition(
|
} else if (this.currentUser.get().hasAnyRole(UserRole.EXAM_ADMIN)) {
|
||||||
navigation.getItems(),
|
return findItemByActionDefinition(
|
||||||
ActivityDefinition.SEB_EXAM_CONFIG);
|
navigation.getItems(),
|
||||||
} else if (this.currentUser.get().hasAnyRole(UserRole.EXAM_SUPPORTER)) {
|
ActivityDefinition.SEB_EXAM_CONFIG);
|
||||||
return findItemByActionDefinition(
|
} else if (this.currentUser.get().hasAnyRole(UserRole.EXAM_SUPPORTER)) {
|
||||||
navigation.getItems(),
|
return findItemByActionDefinition(
|
||||||
ActivityDefinition.MONITORING_EXAMS);
|
navigation.getItems(),
|
||||||
} else {
|
ActivityDefinition.MONITORING_EXAMS);
|
||||||
|
} else {
|
||||||
|
return navigation.getItem(0);
|
||||||
|
}
|
||||||
|
} catch (final Exception e) {
|
||||||
return navigation.getItem(0);
|
return navigation.getItem(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectCurrentItem(final Tree navigation, final TreeItem item) {
|
private void selectCurrentItem(final Tree navigation, final TreeItem item) {
|
||||||
final PageState currentState = this.pageService.getCurrentState();
|
try {
|
||||||
if (currentState == null) {
|
final PageState currentState = this.pageService.getCurrentState();
|
||||||
return;
|
if (currentState == null) {
|
||||||
}
|
return;
|
||||||
final TreeItem currentItem = findItemByActionDefinition(
|
}
|
||||||
item.getItems(),
|
final TreeItem currentItem = findItemByActionDefinition(
|
||||||
currentState.definition.activityAnchor());
|
item.getItems(),
|
||||||
if (currentItem != null) {
|
currentState.definition.activityAnchor());
|
||||||
navigation.select(currentItem);
|
if (currentItem != null) {
|
||||||
|
navigation.select(currentItem);
|
||||||
|
}
|
||||||
|
} catch (final Exception e) {
|
||||||
|
log.warn("Failed to select current navigation item: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleSelection(final PageContext composerCtx, final Event event) {
|
private void handleSelection(final PageContext composerCtx, final Event event) {
|
||||||
final Tree tree = (Tree) event.widget;
|
try {
|
||||||
final TreeItem treeItem = (TreeItem) event.item;
|
final Tree tree = (Tree) event.widget;
|
||||||
|
TreeItem treeItem = (event.item == null && tree.getSelectionCount() == 1)
|
||||||
|
? treeItem = tree.getSelection()[0]
|
||||||
|
: (TreeItem) event.item;
|
||||||
|
|
||||||
if (treeItem.getItemCount() > 0 && !treeItem.getExpanded()) {
|
if (treeItem.getItemCount() > 0 && !treeItem.getExpanded()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final PageAction action = getActivitySelection(treeItem);
|
final PageAction action = getActivitySelection(treeItem);
|
||||||
// if there is no form action associated with the treeItem and the treeItem has sub items, toggle the item state
|
// if there is no form action associated with the treeItem and the treeItem has sub items, toggle the item state
|
||||||
if (action == null) {
|
if (action == null) {
|
||||||
handleParentSelection(tree, treeItem);
|
handleParentSelection(tree, treeItem);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final PageState currentState = this.pageService.getCurrentState();
|
final PageState currentState = this.pageService.getCurrentState();
|
||||||
if (currentState != null && currentState.definition == action.definition.targetState) {
|
if (currentState != null && currentState.definition == action.definition.targetState) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.pageService.executePageAction(
|
this.pageService.executePageAction(
|
||||||
action,
|
action,
|
||||||
resultAction -> {
|
resultAction -> {
|
||||||
if (resultAction.hasError()) {
|
if (resultAction.hasError()) {
|
||||||
tree.deselect(treeItem);
|
tree.deselect(treeItem);
|
||||||
if (currentState != null) {
|
if (currentState != null) {
|
||||||
final TreeItem item = findItemByActionDefinition(
|
final TreeItem item = findItemByActionDefinition(
|
||||||
tree.getItems(),
|
tree.getItems(),
|
||||||
currentState.activityAnchor());
|
currentState.activityAnchor());
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
tree.select(item);
|
tree.select(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
} catch (final Exception e) {
|
||||||
|
log.warn("Failed to select navigation bar: {} cause: {}", event, e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleParentSelection(final Tree tree, final TreeItem treeItem) {
|
private void handleParentSelection(final Tree tree, final TreeItem treeItem) {
|
||||||
|
|
|
@ -44,14 +44,18 @@ public class CheckboxFieldBuilder extends FieldBuilder<String> {
|
||||||
checkbox = builder.widgetFactory.buttonLocalized(
|
checkbox = builder.widgetFactory.buttonLocalized(
|
||||||
fieldGrid,
|
fieldGrid,
|
||||||
SWT.CHECK,
|
SWT.CHECK,
|
||||||
this.label, this.tooltip);
|
this.label,
|
||||||
|
this.tooltip,
|
||||||
|
getARIALabel(builder));
|
||||||
} else {
|
} else {
|
||||||
titleLabel = createTitleLabel(builder.formParent, builder, this);
|
titleLabel = createTitleLabel(builder.formParent, builder, this);
|
||||||
fieldGrid = createFieldGrid(builder.formParent, this.spanInput);
|
fieldGrid = createFieldGrid(builder.formParent, this.spanInput);
|
||||||
checkbox = builder.widgetFactory.buttonLocalized(
|
checkbox = builder.widgetFactory.buttonLocalized(
|
||||||
fieldGrid,
|
fieldGrid,
|
||||||
SWT.CHECK,
|
SWT.CHECK,
|
||||||
null, null);
|
null,
|
||||||
|
null,
|
||||||
|
getARIALabel(builder));
|
||||||
}
|
}
|
||||||
|
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, true);
|
final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, true);
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
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.WidgetFactory;
|
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
|
||||||
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant;
|
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant;
|
||||||
|
|
||||||
|
@ -110,6 +109,14 @@ public abstract class FieldBuilder<T> {
|
||||||
|
|
||||||
abstract void build(FormBuilder builder);
|
abstract void build(FormBuilder builder);
|
||||||
|
|
||||||
|
protected LocTextKey getARIALabel(final FormBuilder builder) {
|
||||||
|
LocTextKey label = this.label;
|
||||||
|
if (this.isMandatory) {
|
||||||
|
label = new LocTextKey("sebserver.form.mandatory.label", builder.i18nSupport.getText(this.label));
|
||||||
|
}
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
protected static Control createTitleLabel(
|
protected static Control createTitleLabel(
|
||||||
final Composite parent,
|
final Composite parent,
|
||||||
final FormBuilder builder,
|
final FormBuilder builder,
|
||||||
|
@ -142,16 +149,8 @@ public abstract class FieldBuilder<T> {
|
||||||
1,
|
1,
|
||||||
fieldBuilder.titleValign);
|
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.isMandatory) {
|
if (fieldBuilder.isMandatory) {
|
||||||
final Label mandatory = builder.widgetFactory.imageButton(
|
final Label mandatory = builder.widgetFactory.mandatoryLabel(
|
||||||
WidgetFactory.ImageIcon.MANDATORY,
|
WidgetFactory.ImageIcon.MANDATORY,
|
||||||
infoGrid,
|
infoGrid,
|
||||||
MANDATORY_TEXT_KEY);
|
MANDATORY_TEXT_KEY);
|
||||||
|
|
|
@ -10,7 +10,6 @@ package ch.ethz.seb.sebserver.gui.form;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gui.service.page.PageService;
|
|
||||||
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.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -18,6 +17,7 @@ import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
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.FileUploadSelection;
|
import ch.ethz.seb.sebserver.gui.widget.FileUploadSelection;
|
||||||
|
|
||||||
public class FileUploadFieldBuilder extends FieldBuilder<String> {
|
public class FileUploadFieldBuilder extends FieldBuilder<String> {
|
||||||
|
@ -41,7 +41,8 @@ public class FileUploadFieldBuilder extends FieldBuilder<String> {
|
||||||
final FileUploadSelection fileUpload = builder.widgetFactory.fileUploadSelection(
|
final FileUploadSelection fileUpload = builder.widgetFactory.fileUploadSelection(
|
||||||
fieldGrid,
|
fieldGrid,
|
||||||
builder.readonly || this.readonly,
|
builder.readonly || this.readonly,
|
||||||
this.supportedFiles);
|
this.supportedFiles,
|
||||||
|
getARIALabel(builder));
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
|
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
|
||||||
fileUpload.setLayoutData(gridData);
|
fileUpload.setLayoutData(gridData);
|
||||||
fileUpload.setFileName(this.value);
|
fileUpload.setFileName(this.value);
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
package ch.ethz.seb.sebserver.gui.form;
|
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.SWT;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -16,6 +15,7 @@ import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
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.ImageUploadSelection;
|
import ch.ethz.seb.sebserver.gui.widget.ImageUploadSelection;
|
||||||
|
|
||||||
public final class ImageUploadFieldBuilder extends FieldBuilder<String> {
|
public final class ImageUploadFieldBuilder extends FieldBuilder<String> {
|
||||||
|
@ -46,7 +46,8 @@ public final class ImageUploadFieldBuilder extends FieldBuilder<String> {
|
||||||
new LocTextKey("sebserver.overall.upload"),
|
new LocTextKey("sebserver.overall.upload"),
|
||||||
builder.readonly || this.readonly,
|
builder.readonly || this.readonly,
|
||||||
this.maxWidth,
|
this.maxWidth,
|
||||||
this.maxHeight);
|
this.maxHeight,
|
||||||
|
getARIALabel(builder));
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
|
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
|
||||||
imageUpload.setLayoutData(gridData);
|
imageUpload.setLayoutData(gridData);
|
||||||
imageUpload.setImageBase64(this.value);
|
imageUpload.setImageBase64(this.value);
|
||||||
|
|
|
@ -33,7 +33,11 @@ public class PasswordFieldBuilder extends FieldBuilder<CharSequence> {
|
||||||
final Control titleLabel = createTitleLabel(builder.formParent, builder, this);
|
final Control titleLabel = createTitleLabel(builder.formParent, builder, this);
|
||||||
final Composite fieldGrid = createFieldGrid(builder.formParent, this.spanInput);
|
final Composite fieldGrid = createFieldGrid(builder.formParent, this.spanInput);
|
||||||
|
|
||||||
final PasswordInput input = new PasswordInput(fieldGrid, builder.widgetFactory);
|
final PasswordInput input = new PasswordInput(
|
||||||
|
fieldGrid,
|
||||||
|
builder.widgetFactory,
|
||||||
|
getARIALabel(builder));
|
||||||
|
|
||||||
input.setEditable(!readonly);
|
input.setEditable(!readonly);
|
||||||
input.setValue((StringUtils.isNotBlank(this.value))
|
input.setValue((StringUtils.isNotBlank(this.value))
|
||||||
? builder.cryptor.decrypt(this.value)
|
? builder.cryptor.decrypt(this.value)
|
||||||
|
|
|
@ -76,7 +76,7 @@ public final class SelectionFieldBuilder extends FieldBuilder<String> {
|
||||||
(builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) ? this.tooltip : null,
|
(builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) ? this.tooltip : null,
|
||||||
null,
|
null,
|
||||||
actionKey,
|
actionKey,
|
||||||
this.label);
|
getARIALabel(builder));
|
||||||
|
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
|
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
|
||||||
((Control) selection).setLayoutData(gridData);
|
((Control) selection).setLayoutData(gridData);
|
||||||
|
|
|
@ -118,11 +118,12 @@ public final class TextFieldBuilder extends FieldBuilder<String> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final LocTextKey label = getARIALabel(builder);
|
||||||
final Text textInput = (this.isNumber)
|
final Text textInput = (this.isNumber)
|
||||||
? builder.widgetFactory.numberInput(fieldGrid, this.numberCheck, readonly, this.label)
|
? builder.widgetFactory.numberInput(fieldGrid, this.numberCheck, readonly, label)
|
||||||
: (this.isArea)
|
: (this.isArea)
|
||||||
? builder.widgetFactory.textAreaInput(fieldGrid, readonly, this.label)
|
? builder.widgetFactory.textAreaInput(fieldGrid, readonly, label)
|
||||||
: builder.widgetFactory.textInput(fieldGrid, this.isPassword, readonly, this.label);
|
: builder.widgetFactory.textInput(fieldGrid, this.isPassword, readonly, label);
|
||||||
|
|
||||||
if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) {
|
if (builder.pageService.getFormTooltipMode() == PageService.FormTooltipMode.INPUT) {
|
||||||
builder.pageService.getPolyglotPageService().injectI18nTooltip(
|
builder.pageService.getPolyglotPageService().injectI18nTooltip(
|
||||||
|
|
|
@ -74,7 +74,8 @@ public class CheckBoxBuilder implements InputFieldBuilder {
|
||||||
(orientation.title == TitleOrientation.NONE)
|
(orientation.title == TitleOrientation.NONE)
|
||||||
? ExamConfigurationService.attributeNameLocKey(attribute)
|
? ExamConfigurationService.attributeNameLocKey(attribute)
|
||||||
: null,
|
: null,
|
||||||
ExamConfigurationService.getToolTipKey(attribute, i18nSupport));
|
ExamConfigurationService.getToolTipKey(attribute, i18nSupport),
|
||||||
|
ExamConfigurationService.attributeNameLocKey(attribute));
|
||||||
|
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
|
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
|
||||||
gridData.verticalIndent = 0;
|
gridData.verticalIndent = 0;
|
||||||
|
|
|
@ -24,6 +24,7 @@ import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation;
|
||||||
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
|
||||||
import ch.ethz.seb.sebserver.gbl.util.Cryptor;
|
import ch.ethz.seb.sebserver.gbl.util.Cryptor;
|
||||||
import ch.ethz.seb.sebserver.gui.form.FieldBuilder;
|
import ch.ethz.seb.sebserver.gui.form.FieldBuilder;
|
||||||
|
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.InputField;
|
||||||
import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder;
|
import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder;
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
||||||
|
@ -73,11 +74,22 @@ public class PasswordFieldBuilder implements InputFieldBuilder {
|
||||||
final Composite innerGrid = InputFieldBuilder
|
final Composite innerGrid = InputFieldBuilder
|
||||||
.createInnerGrid(parent, attribute, orientation);
|
.createInnerGrid(parent, attribute, orientation);
|
||||||
|
|
||||||
final PasswordInput passwordInput = new PasswordInput(innerGrid, this.widgetFactory);
|
final LocTextKey attributeNameLocKey = ExamConfigurationService.attributeNameLocKey(attribute);
|
||||||
|
final PasswordInput passwordInput = new PasswordInput(
|
||||||
|
innerGrid,
|
||||||
|
this.widgetFactory,
|
||||||
|
attributeNameLocKey);
|
||||||
final GridData passwordInputLD = new GridData(SWT.FILL, SWT.FILL, true, true);
|
final GridData passwordInputLD = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||||
passwordInput.setLayoutData(passwordInputLD);
|
passwordInput.setLayoutData(passwordInputLD);
|
||||||
|
|
||||||
final PasswordInput confirmInput = new PasswordInput(innerGrid, this.widgetFactory);
|
final LocTextKey confirmNameLocKey =
|
||||||
|
new LocTextKey(
|
||||||
|
"sebserver.form.confirm.label",
|
||||||
|
viewContext.i18nSupport.getText(attributeNameLocKey));
|
||||||
|
final PasswordInput confirmInput = new PasswordInput(
|
||||||
|
innerGrid,
|
||||||
|
this.widgetFactory,
|
||||||
|
confirmNameLocKey);
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||||
gridData.verticalIndent = 14;
|
gridData.verticalIndent = 14;
|
||||||
confirmInput.setLayoutData(gridData);
|
confirmInput.setLayoutData(gridData);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.layout.RowData;
|
import org.eclipse.swt.layout.RowData;
|
||||||
import org.eclipse.swt.layout.RowLayout;
|
import org.eclipse.swt.layout.RowLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.DateTime;
|
import org.eclipse.swt.widgets.DateTime;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
@ -199,13 +200,13 @@ public class TableFilter<ROW> {
|
||||||
|
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.BOTTOM, true, true);
|
final GridData gridData = new GridData(SWT.FILL, SWT.BOTTOM, true, true);
|
||||||
gridData.heightHint = 20;
|
gridData.heightHint = 20;
|
||||||
final Label imageButton = this.entityTable.widgetFactory.imageButton(
|
final Button imageButton = this.entityTable.widgetFactory.imageButton(
|
||||||
ImageIcon.SEARCH,
|
ImageIcon.SEARCH,
|
||||||
inner,
|
inner,
|
||||||
new LocTextKey("sebserver.overall.action.filter"),
|
new LocTextKey("sebserver.overall.action.filter"),
|
||||||
event -> this.entityTable.applyFilter());
|
event -> this.entityTable.applyFilter());
|
||||||
imageButton.setLayoutData(gridData);
|
imageButton.setLayoutData(gridData);
|
||||||
final Label imageButton2 = this.entityTable.widgetFactory.imageButton(
|
final Button imageButton2 = this.entityTable.widgetFactory.imageButton(
|
||||||
ImageIcon.CANCEL,
|
ImageIcon.CANCEL,
|
||||||
inner,
|
inner,
|
||||||
new LocTextKey("sebserver.overall.action.filter.clear"),
|
new LocTextKey("sebserver.overall.action.filter.clear"),
|
||||||
|
@ -267,6 +268,10 @@ public class TableFilter<ROW> {
|
||||||
inner.setLayoutData(this.rowData);
|
inner.setLayoutData(this.rowData);
|
||||||
return inner;
|
return inner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected LocTextKey getAriaLabel() {
|
||||||
|
return new LocTextKey("sebserver.form.tablefilter.label", this.attribute.columnName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class NullFilter extends FilterComponent {
|
private static class NullFilter extends FilterComponent {
|
||||||
|
@ -323,7 +328,8 @@ public class TableFilter<ROW> {
|
||||||
|
|
||||||
this.textInput = TableFilter.this.entityTable.widgetFactory.textInput(
|
this.textInput = TableFilter.this.entityTable.widgetFactory.textInput(
|
||||||
innerComposite,
|
innerComposite,
|
||||||
super.attribute.columnName);
|
getAriaLabel());
|
||||||
|
|
||||||
this.textInput.setLayoutData(gridData);
|
this.textInput.setLayoutData(gridData);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +382,7 @@ public class TableFilter<ROW> {
|
||||||
ch.ethz.seb.sebserver.gui.widget.Selection.Type.SINGLE,
|
ch.ethz.seb.sebserver.gui.widget.Selection.Type.SINGLE,
|
||||||
innerComposite,
|
innerComposite,
|
||||||
resourceSupplier,
|
resourceSupplier,
|
||||||
this.attribute.columnName);
|
getAriaLabel());
|
||||||
|
|
||||||
this.selector
|
this.selector
|
||||||
.adaptToControl()
|
.adaptToControl()
|
||||||
|
@ -430,7 +436,9 @@ public class TableFilter<ROW> {
|
||||||
@Override
|
@Override
|
||||||
FilterComponent build(final Composite parent) {
|
FilterComponent build(final Composite parent) {
|
||||||
final Composite innerComposite = createInnerComposite(parent);
|
final Composite innerComposite = createInnerComposite(parent);
|
||||||
this.selector = TableFilter.this.entityTable.widgetFactory.dateSelector(innerComposite);
|
this.selector = TableFilter.this.entityTable.widgetFactory.dateSelector(
|
||||||
|
innerComposite,
|
||||||
|
getAriaLabel());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,15 +531,15 @@ public class TableFilter<ROW> {
|
||||||
|
|
||||||
final WidgetFactory wf = TableFilter.this.entityTable.widgetFactory;
|
final WidgetFactory wf = TableFilter.this.entityTable.widgetFactory;
|
||||||
wf.labelLocalized(this.innerComposite, DATE_FROM_TEXT);
|
wf.labelLocalized(this.innerComposite, DATE_FROM_TEXT);
|
||||||
this.fromDateSelector = wf.dateSelector(this.innerComposite);
|
this.fromDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel());
|
||||||
if (this.withTime) {
|
if (this.withTime) {
|
||||||
this.fromTimeSelector = wf.timeSelector(this.innerComposite);
|
this.fromTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel());
|
||||||
}
|
}
|
||||||
|
|
||||||
wf.labelLocalized(this.innerComposite, DATE_TO_TEXT);
|
wf.labelLocalized(this.innerComposite, DATE_TO_TEXT);
|
||||||
this.toDateSelector = wf.dateSelector(this.innerComposite);
|
this.toDateSelector = wf.dateSelector(this.innerComposite, getAriaLabel());
|
||||||
if (this.withTime) {
|
if (this.withTime) {
|
||||||
this.toTimeSelector = wf.timeSelector(this.innerComposite);
|
this.toTimeSelector = wf.timeSelector(this.innerComposite, getAriaLabel());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.ColorDialog;
|
import org.eclipse.swt.widgets.ColorDialog;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
|
@ -83,7 +84,7 @@ public final class ColorSelection extends Composite implements Selection {
|
||||||
this.colorLabel.setLayoutData(gridData);
|
this.colorLabel.setLayoutData(gridData);
|
||||||
this.colorLabel.setData(RWT.CUSTOM_VARIANT, CustomVariant.LIGHT_COLOR_LABEL.key);
|
this.colorLabel.setData(RWT.CUSTOM_VARIANT, CustomVariant.LIGHT_COLOR_LABEL.key);
|
||||||
|
|
||||||
final Label imageButton = widgetFactory.imageButton(
|
final Button imageButton = widgetFactory.imageButton(
|
||||||
ImageIcon.COLOR,
|
ImageIcon.COLOR,
|
||||||
this,
|
this,
|
||||||
(StringUtils.isNotBlank(tooltipKeyPrefix)
|
(StringUtils.isNotBlank(tooltipKeyPrefix)
|
||||||
|
|
|
@ -36,6 +36,7 @@ import ch.ethz.seb.sebserver.gbl.Constants;
|
||||||
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
|
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
||||||
|
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.AriaRole;
|
||||||
|
|
||||||
public class FileUploadSelection extends Composite {
|
public class FileUploadSelection extends Composite {
|
||||||
|
|
||||||
|
@ -63,7 +64,8 @@ public class FileUploadSelection extends Composite {
|
||||||
final Composite parent,
|
final Composite parent,
|
||||||
final I18nSupport i18nSupport,
|
final I18nSupport i18nSupport,
|
||||||
final Collection<String> supportedFiles,
|
final Collection<String> supportedFiles,
|
||||||
final boolean readonly) {
|
final boolean readonly,
|
||||||
|
final LocTextKey ariaLabel) {
|
||||||
|
|
||||||
super(parent, SWT.NONE);
|
super(parent, SWT.NONE);
|
||||||
final GridLayout gridLayout = new GridLayout(2, false);
|
final GridLayout gridLayout = new GridLayout(2, false);
|
||||||
|
@ -80,6 +82,9 @@ public class FileUploadSelection extends Composite {
|
||||||
this.fileName = new Label(this, SWT.NONE);
|
this.fileName = new Label(this, SWT.NONE);
|
||||||
this.fileName.setText(i18nSupport.getText(PLEASE_SELECT_TEXT));
|
this.fileName.setText(i18nSupport.getText(PLEASE_SELECT_TEXT));
|
||||||
this.fileName.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
|
this.fileName.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
|
||||||
|
if (ariaLabel != null) {
|
||||||
|
WidgetFactory.setARIALabel(this.fileName, i18nSupport.getText(ariaLabel));
|
||||||
|
}
|
||||||
this.fileUpload = null;
|
this.fileUpload = null;
|
||||||
this.uploadHandler = null;
|
this.uploadHandler = null;
|
||||||
this.inputReceiver = null;
|
this.inputReceiver = null;
|
||||||
|
@ -88,6 +93,11 @@ public class FileUploadSelection extends Composite {
|
||||||
this.fileUpload.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
|
this.fileUpload.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
|
||||||
this.fileUpload.setImage(WidgetFactory.ImageIcon.IMPORT.getImage(parent.getDisplay()));
|
this.fileUpload.setImage(WidgetFactory.ImageIcon.IMPORT.getImage(parent.getDisplay()));
|
||||||
|
|
||||||
|
if (ariaLabel != null) {
|
||||||
|
WidgetFactory.setARIALabel(this.fileUpload, i18nSupport.getText(ariaLabel));
|
||||||
|
}
|
||||||
|
WidgetFactory.setARIARole(this.fileUpload, AriaRole.button);
|
||||||
|
|
||||||
this.fileUpload.setToolTipText(Utils.formatLineBreaks(this.i18nSupport.getText(PLEASE_SELECT_TEXT)));
|
this.fileUpload.setToolTipText(Utils.formatLineBreaks(this.i18nSupport.getText(PLEASE_SELECT_TEXT)));
|
||||||
this.inputReceiver = new InputReceiver();
|
this.inputReceiver = new InputReceiver();
|
||||||
this.uploadHandler = new FileUploadHandler(this.inputReceiver);
|
this.uploadHandler = new FileUploadHandler(this.inputReceiver);
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class GridTable extends Composite {
|
||||||
|
|
||||||
private final WidgetFactory widgetFactory;
|
private final WidgetFactory widgetFactory;
|
||||||
private final List<Column> columns;
|
private final List<Column> columns;
|
||||||
private final Label addAction;
|
private final Button addAction;
|
||||||
private final List<Row> rows;
|
private final List<Row> rows;
|
||||||
private final String locTextKeyPrefix;
|
private final String locTextKeyPrefix;
|
||||||
private Listener listener;
|
private Listener listener;
|
||||||
|
@ -222,7 +222,7 @@ public class GridTable extends Composite {
|
||||||
|
|
||||||
final class Row {
|
final class Row {
|
||||||
final List<ControlAdapter> cells;
|
final List<ControlAdapter> cells;
|
||||||
final Label removeAction;
|
final Button removeAction;
|
||||||
|
|
||||||
protected Row(final List<ControlAdapter> cells) {
|
protected Row(final List<ControlAdapter> cells) {
|
||||||
this.cells = cells;
|
this.cells = cells;
|
||||||
|
|
|
@ -40,8 +40,10 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
|
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
||||||
import ch.ethz.seb.sebserver.gui.service.push.ServerPushContext;
|
import ch.ethz.seb.sebserver.gui.service.push.ServerPushContext;
|
||||||
import ch.ethz.seb.sebserver.gui.service.push.ServerPushService;
|
import ch.ethz.seb.sebserver.gui.service.push.ServerPushService;
|
||||||
|
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.AriaRole;
|
||||||
|
|
||||||
public final class ImageUploadSelection extends Composite {
|
public final class ImageUploadSelection extends Composite {
|
||||||
|
|
||||||
|
@ -71,7 +73,8 @@ public final class ImageUploadSelection extends Composite {
|
||||||
final I18nSupport i18nSupport,
|
final I18nSupport i18nSupport,
|
||||||
final boolean readonly,
|
final boolean readonly,
|
||||||
final int maxWidth,
|
final int maxWidth,
|
||||||
final int maxHeight) {
|
final int maxHeight,
|
||||||
|
final LocTextKey ariaLabel) {
|
||||||
|
|
||||||
super(parent, SWT.NONE);
|
super(parent, SWT.NONE);
|
||||||
final GridLayout gridLayout = new GridLayout(1, false);
|
final GridLayout gridLayout = new GridLayout(1, false);
|
||||||
|
@ -93,6 +96,11 @@ public final class ImageUploadSelection extends Composite {
|
||||||
gridData.horizontalIndent = 0;
|
gridData.horizontalIndent = 0;
|
||||||
this.fileUpload.setLayoutData(gridData);
|
this.fileUpload.setLayoutData(gridData);
|
||||||
|
|
||||||
|
if (ariaLabel != null) {
|
||||||
|
WidgetFactory.setARIALabel(this.fileUpload, i18nSupport.getText(ariaLabel));
|
||||||
|
}
|
||||||
|
WidgetFactory.setARIARole(this.fileUpload, AriaRole.button);
|
||||||
|
|
||||||
final FileUploadHandler uploadHandler = new FileUploadHandler(new ImageReceiver());
|
final FileUploadHandler uploadHandler = new FileUploadHandler(new ImageReceiver());
|
||||||
this.fileUpload.addListener(SWT.Selection, event -> {
|
this.fileUpload.addListener(SWT.Selection, event -> {
|
||||||
final String fileName = ImageUploadSelection.this.fileUpload.getFileName();
|
final String fileName = ImageUploadSelection.this.fileUpload.getFileName();
|
||||||
|
|
|
@ -13,9 +13,9 @@ 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.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Label;
|
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import ch.ethz.seb.sebserver.gbl.Constants;
|
import ch.ethz.seb.sebserver.gbl.Constants;
|
||||||
|
@ -30,15 +30,21 @@ public class PasswordInput extends Composite {
|
||||||
new LocTextKey("sebserver.overall.action.showPassword.tooltip");
|
new LocTextKey("sebserver.overall.action.showPassword.tooltip");
|
||||||
|
|
||||||
private final Composite inputAnchor;
|
private final Composite inputAnchor;
|
||||||
private final Label visibilityButton;
|
private final Button visibilityButton;
|
||||||
|
|
||||||
private Text passwordInputField = null;
|
private Text passwordInputField = null;
|
||||||
private boolean isPlainText = true;
|
private boolean isPlainText = true;
|
||||||
private boolean isEditable = true;
|
private boolean isEditable = true;
|
||||||
|
private String label = null;
|
||||||
|
|
||||||
|
public PasswordInput(
|
||||||
|
final Composite parent,
|
||||||
|
final WidgetFactory widgetFactory,
|
||||||
|
final LocTextKey label) {
|
||||||
|
|
||||||
public PasswordInput(final Composite parent, final WidgetFactory widgetFactory) {
|
|
||||||
super(parent, SWT.NONE);
|
super(parent, SWT.NONE);
|
||||||
|
|
||||||
|
this.label = widgetFactory.getI18nSupport().getText(label);
|
||||||
GridLayout gridLayout = new GridLayout(2, false);
|
GridLayout gridLayout = new GridLayout(2, false);
|
||||||
gridLayout.horizontalSpacing = 0;
|
gridLayout.horizontalSpacing = 0;
|
||||||
gridLayout.verticalSpacing = 0;
|
gridLayout.verticalSpacing = 0;
|
||||||
|
@ -107,6 +113,10 @@ public class PasswordInput extends Composite {
|
||||||
this.visibilityButton.setImage(WidgetFactory.ImageIcon.VISIBILITY_OFF.getImage(getDisplay()));
|
this.visibilityButton.setImage(WidgetFactory.ImageIcon.VISIBILITY_OFF.getImage(getDisplay()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.label != null) {
|
||||||
|
WidgetFactory.setARIALabel(passwordInput, this.label);
|
||||||
|
}
|
||||||
|
|
||||||
this.passwordInputField = passwordInput;
|
this.passwordInputField = passwordInput;
|
||||||
this.isPlainText = !this.isPlainText;
|
this.isPlainText = !this.isPlainText;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
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.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
@ -102,7 +103,7 @@ public final class ThresholdList extends Composite {
|
||||||
this.colorCell = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
this.colorCell = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
||||||
colorTitle.setLayoutData(this.colorCell);
|
colorTitle.setLayoutData(this.colorCell);
|
||||||
|
|
||||||
final Label imageButton = widgetFactory.imageButton(
|
final Button imageButton = widgetFactory.imageButton(
|
||||||
ImageIcon.ADD_BOX,
|
ImageIcon.ADD_BOX,
|
||||||
this,
|
this,
|
||||||
ADD_TEXT_KEY,
|
ADD_TEXT_KEY,
|
||||||
|
@ -165,7 +166,7 @@ public final class ThresholdList extends Composite {
|
||||||
selectorCell.horizontalIndent = 2;
|
selectorCell.horizontalIndent = 2;
|
||||||
selector.adaptToControl().setLayoutData(selectorCell);
|
selector.adaptToControl().setLayoutData(selectorCell);
|
||||||
|
|
||||||
final Label imageButton = this.widgetFactory.imageButton(
|
final Button imageButton = this.widgetFactory.imageButton(
|
||||||
ImageIcon.REMOVE_BOX,
|
ImageIcon.REMOVE_BOX,
|
||||||
this,
|
this,
|
||||||
REMOVE_TEXT_KEY,
|
REMOVE_TEXT_KEY,
|
||||||
|
@ -216,9 +217,9 @@ public final class ThresholdList extends Composite {
|
||||||
private final class Entry {
|
private final class Entry {
|
||||||
final Text valueInput;
|
final Text valueInput;
|
||||||
final Selection colorSelector;
|
final Selection colorSelector;
|
||||||
final Label removeButton;
|
final Button removeButton;
|
||||||
|
|
||||||
Entry(final Text valueInput, final Selection colorSelector, final Label removeButton) {
|
Entry(final Text valueInput, final Selection colorSelector, final Button removeButton) {
|
||||||
super();
|
super();
|
||||||
this.valueInput = valueInput;
|
this.valueInput = valueInput;
|
||||||
this.colorSelector = colorSelector;
|
this.colorSelector = colorSelector;
|
||||||
|
|
|
@ -14,7 +14,6 @@ import java.io.InputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
@ -80,7 +79,8 @@ public class WidgetFactory {
|
||||||
row,
|
row,
|
||||||
rowgroup,
|
rowgroup,
|
||||||
columnheader,
|
columnheader,
|
||||||
gridcell
|
gridcell,
|
||||||
|
dialog
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(WidgetFactory.class);
|
private static final Logger log = LoggerFactory.getLogger(WidgetFactory.class);
|
||||||
|
@ -400,10 +400,14 @@ public class WidgetFactory {
|
||||||
final Composite parent,
|
final Composite parent,
|
||||||
final int type,
|
final int type,
|
||||||
final LocTextKey locTextKey,
|
final LocTextKey locTextKey,
|
||||||
final LocTextKey toolTipKey) {
|
final LocTextKey toolTipKey,
|
||||||
|
final LocTextKey ariaLabel) {
|
||||||
|
|
||||||
final Button button = new Button(parent, type);
|
final Button button = new Button(parent, type);
|
||||||
setARIARole(button, AriaRole.button);
|
setARIARole(button, AriaRole.button);
|
||||||
|
if (ariaLabel != null) {
|
||||||
|
setARIALabel(button, this.i18nSupport.getText(ariaLabel));
|
||||||
|
}
|
||||||
this.polyglotPageService.injectI18n(button, locTextKey, toolTipKey);
|
this.polyglotPageService.injectI18n(button, locTextKey, toolTipKey);
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
@ -742,27 +746,35 @@ public class WidgetFactory {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Label imageButton(
|
public Label mandatoryLabel(
|
||||||
final ImageIcon type,
|
final ImageIcon type,
|
||||||
final Composite parent,
|
final Composite parent,
|
||||||
final LocTextKey toolTip) {
|
final LocTextKey toolTip) {
|
||||||
|
|
||||||
return this.imageButton(type, parent, toolTip, null);
|
final Label imageButton = labelLocalized(parent, (LocTextKey) null, toolTip);
|
||||||
|
imageButton.setImage(type.getImage(parent.getDisplay()));
|
||||||
|
return imageButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Label imageButton(
|
public Button imageButton(
|
||||||
final ImageIcon type,
|
final ImageIcon type,
|
||||||
final Composite parent,
|
final Composite parent,
|
||||||
final LocTextKey toolTip,
|
final LocTextKey toolTip,
|
||||||
final Listener listener) {
|
final Listener listener) {
|
||||||
|
|
||||||
final Label imageButton = labelLocalized(parent, (LocTextKey) null, toolTip);
|
final Button imageButton = new Button(parent, SWT.NONE);
|
||||||
imageButton.setData(RWT.CUSTOM_VARIANT, CustomVariant.IMAGE_BUTTON.name());
|
this.polyglotPageService.injectI18n(imageButton, null, toolTip);
|
||||||
imageButton.setImage(type.getImage(parent.getDisplay()));
|
imageButton.setData(RWT.CUSTOM_VARIANT, CustomVariant.IMAGE_BUTTON.key);
|
||||||
|
final Image image = type.getImage(parent.getDisplay());
|
||||||
|
imageButton.setImage(image);
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
imageButton.addListener(SWT.MouseDown, listener);
|
imageButton.addListener(SWT.MouseDown, listener);
|
||||||
|
imageButton.addListener(SWT.Selection, listener);
|
||||||
}
|
}
|
||||||
setARIARole(imageButton, AriaRole.button);
|
setARIARole(imageButton, AriaRole.button);
|
||||||
|
if (toolTip != null) {
|
||||||
|
setARIALabel(imageButton, this.i18nSupport.getText(toolTip));
|
||||||
|
}
|
||||||
return imageButton;
|
return imageButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,30 +911,40 @@ public class WidgetFactory {
|
||||||
return selection;
|
return selection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime dateSelector(final Composite parent) {
|
public DateTime dateSelector(final Composite parent, final LocTextKey label) {
|
||||||
RWT.setLocale(Locale.GERMANY);
|
RWT.setLocale(this.i18nSupport.getUsersFormatLocale());
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||||
final DateTime dateTime = new DateTime(parent, SWT.DATE | SWT.BORDER | SWT.DROP_DOWN);
|
final DateTime dateTime = new DateTime(parent, SWT.DATE | SWT.BORDER | SWT.DROP_DOWN);
|
||||||
dateTime.setLayoutData(gridData);
|
dateTime.setLayoutData(gridData);
|
||||||
|
if (label != null) {
|
||||||
|
setARIALabel(dateTime, this.i18nSupport.getText(label));
|
||||||
|
}
|
||||||
return dateTime;
|
return dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime timeSelector(final Composite parent) {
|
public DateTime timeSelector(final Composite parent, final LocTextKey label) {
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||||
final DateTime dateTime = new DateTime(parent, SWT.TIME | SWT.BORDER | SWT.SHORT);
|
final DateTime dateTime = new DateTime(parent, SWT.TIME | SWT.BORDER | SWT.SHORT);
|
||||||
dateTime.setLayoutData(gridData);
|
dateTime.setLayoutData(gridData);
|
||||||
|
if (label != null) {
|
||||||
|
setARIALabel(dateTime, this.i18nSupport.getText(label));
|
||||||
|
}
|
||||||
return dateTime;
|
return dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime timeSelectorWithSeconds(final Composite parent) {
|
public DateTime timeSelectorWithSeconds(final Composite parent, final LocTextKey label) {
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||||
final DateTime dateTime = new DateTime(parent, SWT.TIME | SWT.BORDER | SWT.MEDIUM);
|
final DateTime dateTime = new DateTime(parent, SWT.TIME | SWT.BORDER | SWT.MEDIUM);
|
||||||
dateTime.setLayoutData(gridData);
|
dateTime.setLayoutData(gridData);
|
||||||
|
if (label != null) {
|
||||||
|
setARIALabel(dateTime, this.i18nSupport.getText(label));
|
||||||
|
}
|
||||||
return dateTime;
|
return dateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ColorDialog getColorDialog(final Composite parent) {
|
public ColorDialog getColorDialog(final Composite parent) {
|
||||||
return new ColorDialog(parent.getShell(), SWT.NONE);
|
final ColorDialog colorDialog = new ColorDialog(parent.getShell(), SWT.NONE);
|
||||||
|
return colorDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThresholdList thresholdList(
|
public ThresholdList thresholdList(
|
||||||
|
@ -945,14 +967,16 @@ public class WidgetFactory {
|
||||||
public ImageUploadSelection logoImageUploadLocalized(
|
public ImageUploadSelection logoImageUploadLocalized(
|
||||||
final Composite parent,
|
final Composite parent,
|
||||||
final LocTextKey locTextKey,
|
final LocTextKey locTextKey,
|
||||||
final boolean readonly) {
|
final boolean readonly,
|
||||||
|
final LocTextKey label) {
|
||||||
|
|
||||||
return imageUploadLocalized(
|
return imageUploadLocalized(
|
||||||
parent,
|
parent,
|
||||||
locTextKey,
|
locTextKey,
|
||||||
readonly,
|
readonly,
|
||||||
DefaultPageLayout.LOGO_IMAGE_MAX_WIDTH,
|
DefaultPageLayout.LOGO_IMAGE_MAX_WIDTH,
|
||||||
DefaultPageLayout.LOGO_IMAGE_MAX_HEIGHT);
|
DefaultPageLayout.LOGO_IMAGE_MAX_HEIGHT,
|
||||||
|
label);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageUploadSelection imageUploadLocalized(
|
public ImageUploadSelection imageUploadLocalized(
|
||||||
|
@ -960,7 +984,8 @@ public class WidgetFactory {
|
||||||
final LocTextKey locTextKey,
|
final LocTextKey locTextKey,
|
||||||
final boolean readonly,
|
final boolean readonly,
|
||||||
final int maxWidth,
|
final int maxWidth,
|
||||||
final int maxHeight) {
|
final int maxHeight,
|
||||||
|
final LocTextKey label) {
|
||||||
|
|
||||||
final ImageUploadSelection imageUpload = new ImageUploadSelection(
|
final ImageUploadSelection imageUpload = new ImageUploadSelection(
|
||||||
parent,
|
parent,
|
||||||
|
@ -968,7 +993,8 @@ public class WidgetFactory {
|
||||||
this.i18nSupport,
|
this.i18nSupport,
|
||||||
readonly,
|
readonly,
|
||||||
maxWidth,
|
maxWidth,
|
||||||
maxHeight);
|
maxHeight,
|
||||||
|
label);
|
||||||
|
|
||||||
this.polyglotPageService.injectI18n(imageUpload, locTextKey);
|
this.polyglotPageService.injectI18n(imageUpload, locTextKey);
|
||||||
return imageUpload;
|
return imageUpload;
|
||||||
|
@ -977,13 +1003,15 @@ public class WidgetFactory {
|
||||||
public FileUploadSelection fileUploadSelection(
|
public FileUploadSelection fileUploadSelection(
|
||||||
final Composite parent,
|
final Composite parent,
|
||||||
final boolean readonly,
|
final boolean readonly,
|
||||||
final Collection<String> supportedFiles) {
|
final Collection<String> supportedFiles,
|
||||||
|
final LocTextKey label) {
|
||||||
|
|
||||||
final FileUploadSelection fileUploadSelection = new FileUploadSelection(
|
final FileUploadSelection fileUploadSelection = new FileUploadSelection(
|
||||||
parent,
|
parent,
|
||||||
this.i18nSupport,
|
this.i18nSupport,
|
||||||
supportedFiles,
|
supportedFiles,
|
||||||
readonly);
|
readonly,
|
||||||
|
label);
|
||||||
|
|
||||||
if (supportedFiles != null) {
|
if (supportedFiles != null) {
|
||||||
supportedFiles.forEach(fileUploadSelection::withSupportFor);
|
supportedFiles.forEach(fileUploadSelection::withSupportFor);
|
||||||
|
|
|
@ -96,6 +96,9 @@ sebserver.error.unexpected=Unexpected Error
|
||||||
sebserver.page.message=Information
|
sebserver.page.message=Information
|
||||||
sebserver.dialog.confirm.title=Confirmation
|
sebserver.dialog.confirm.title=Confirmation
|
||||||
sebserver.form.mandatory=This field is mandatory.
|
sebserver.form.mandatory=This field is mandatory.
|
||||||
|
sebserver.form.mandatory.label={0} mandatory
|
||||||
|
sebserver.form.confirm.label=confirm {0}
|
||||||
|
sebserver.form.tablefilter.label={0} table-column filter
|
||||||
sebserver.table.column.sort.default.tooltip=Click on the column header to sort the table within this column
|
sebserver.table.column.sort.default.tooltip=Click on the column header to sort the table within this column
|
||||||
|
|
||||||
sebserver.dialog.confirm.deactivation=Note that there are {0} other entities that belong to this entity.<br/>Those will also be deactivated by deactivating this entity.<br/><br/>Are You sure to deactivate this entity?
|
sebserver.dialog.confirm.deactivation=Note that there are {0} other entities that belong to this entity.<br/>Those will also be deactivated by deactivating this entity.<br/><br/>Are You sure to deactivate this entity?
|
||||||
|
|
|
@ -517,6 +517,30 @@ Button {
|
||||||
padding: 5px 6px 5px 6px;
|
padding: 5px 6px 5px 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button.imageButton,
|
||||||
|
Button:hover.imageButton,
|
||||||
|
Button:hover.imageButton,
|
||||||
|
Button:default.imageButton,
|
||||||
|
Button:pressed.imageButton {
|
||||||
|
font: 12px Arial, Helvetica, sans-serif;
|
||||||
|
background-color: transparent;
|
||||||
|
background-gradient-color: transparent;
|
||||||
|
background-image: gradient( linear, left top, left bottom, from( transparent ), to( transparent ) );
|
||||||
|
padding: 0px 0px 0px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
Button[PUSH].imageButton,
|
||||||
|
Button[PUSH]:hover.imageButton,
|
||||||
|
Button[PUSH]:hover.imageButton,
|
||||||
|
Button[PUSH]:default.imageButton,
|
||||||
|
Button[PUSH]:pressed.imageButton {
|
||||||
|
font: 12px Arial, Helvetica, sans-serif;
|
||||||
|
background-color: transparent;
|
||||||
|
background-gradient-color: transparent;
|
||||||
|
background-image: gradient( linear, left top, left bottom, from( transparent ), to( transparent ) );
|
||||||
|
padding: 0px 0px 0px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Push Buttons */
|
/* Push Buttons */
|
||||||
Button[PUSH],
|
Button[PUSH],
|
||||||
Button[PUSH]:default {
|
Button[PUSH]:default {
|
||||||
|
|
|
@ -395,6 +395,13 @@ Button {
|
||||||
padding: 5px 6px 5px 6px;
|
padding: 5px 6px 5px 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button[PUSH]:hover.imageButton {
|
||||||
|
font: 12px Arial, Helvetica, sans-serif;
|
||||||
|
padding: 5px 6px 5px 6px;
|
||||||
|
background-color: transparent;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
/* Push Buttons */
|
/* Push Buttons */
|
||||||
Button[PUSH],
|
Button[PUSH],
|
||||||
Button[PUSH]:default {
|
Button[PUSH]:default {
|
||||||
|
|
Loading…
Add table
Reference in a new issue