SEBSERV-486 fixed by better usability

This commit is contained in:
anhefti 2023-11-21 09:16:15 +01:00
parent 8b15fddf13
commit f0ab907866
8 changed files with 26 additions and 11 deletions

View file

@ -869,7 +869,7 @@ public enum ActionDefinition {
SEB_EXAM_CONFIG_TEMPLATE_ATTR_FORM_SET_DEFAULT(
new LocTextKey("sebserver.configtemplate.attr.action.setdefault"),
ImageIcon.UNDO,
ImageIcon.RESET,
PageStateDefinitionImpl.SEB_EXAM_CONFIG_TEMPLATE_ATTRIBUTE_EDIT,
ActionCategory.FORM),
SEB_EXAM_CONFIG_TEMPLATE_ATTR_FORM_EDIT_TEMPLATE(

View file

@ -69,6 +69,8 @@ public class ConfigTemplateAttributeForm implements TemplateComposer {
new LocTextKey("sebserver.configtemplate.attr.form.value");
private static final LocTextKey FORM_VALUE_TOOLTIP_TEXT_KEY =
new LocTextKey("sebserver.configtemplate.attr.form.value" + Constants.TOOLTIP_TEXT_KEY_SUFFIX);
public static final LocTextKey CONF_TEXT_RESET_VALUES =
new LocTextKey("sebserver.configtemplate.attr.list.actions.setdefault.confirm");
private final PageService pageService;
private final RestService restService;
@ -137,7 +139,7 @@ public class ConfigTemplateAttributeForm implements TemplateComposer {
final boolean _hasView = hasView;
this.pageService.formBuilder(formContext)
.readonly(true) // TODO change this for next version
.readonly(true)
.addField(FormBuilder.text(
Domain.CONFIGURATION_ATTRIBUTE.ATTR_NAME,
FORM_NAME_TEXT_KEY,
@ -183,7 +185,7 @@ public class ConfigTemplateAttributeForm implements TemplateComposer {
final ViewContext viewContext = this.examConfigurationService.createViewContext(
valueContext,
configuration,
new View(-1L, "template", 10, 0, templateId),
new View(-1L, ViewContext.TEMPLATE_VIEW_NAME, 10, 0, templateId),
viewName -> null,
attributeMapping,
1, false, null);
@ -211,9 +213,15 @@ public class ConfigTemplateAttributeForm implements TemplateComposer {
final boolean _hasView = hasView;
this.pageService.pageActionBuilder(pageContext.clearEntityKeys())
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_FORM_EDIT_TEMPLATE)
.withEntityKey(templateKey)
.ignoreMoveAwayFromEdit()
.publish()
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_FORM_SET_DEFAULT)
.withEntityKey(attributeKey)
.withParentEntityKey(templateKey)
.withConfirm(() -> CONF_TEXT_RESET_VALUES)
.withExec(this.examConfigurationService::resetToDefaults)
.ignoreMoveAwayFromEdit()
.publishIf(() -> _modifyGrant)
@ -231,11 +239,8 @@ public class ConfigTemplateAttributeForm implements TemplateComposer {
.withExec(this.examConfigurationService::attachToDefaultView)
.ignoreMoveAwayFromEdit()
.publishIf(() -> _modifyGrant && !_hasView)
;
.newAction(ActionDefinition.SEB_EXAM_CONFIG_TEMPLATE_ATTR_FORM_EDIT_TEMPLATE)
.withEntityKey(templateKey)
.ignoreMoveAwayFromEdit()
.publish();
}

View file

@ -71,7 +71,7 @@ public class CheckBoxBuilder implements InputFieldBuilder {
final Button checkbox = this.widgetFactory.buttonLocalized(
innerGrid,
SWT.CHECK,
(orientation.title == TitleOrientation.NONE)
(orientation.title == TitleOrientation.NONE || viewContext.isTemplateView())
? ExamConfigurationService.attributeNameLocKey(attribute)
: null,
ExamConfigurationService.getToolTipKey(attribute, i18nSupport),

View file

@ -233,7 +233,7 @@ public class ExamConfigurationServiceImpl implements ExamConfigurationService {
final Long configurationId,
final Collection<ViewContext> viewContexts) {
if (viewContexts == null || viewContexts.size() < 1) {
if (viewContexts == null || viewContexts.isEmpty()) {
log.warn("No viewContexts available");
return;
}

View file

@ -36,6 +36,7 @@ public final class ViewContext {
/** Defines a list of checkbox fields that are inverted on the display of SEB settings */
public static final Set<String> INVERTED_CHECKBOX_SETTINGS = new HashSet<>(Arrays.asList(
"enableSebBrowser"));
public static final String TEMPLATE_VIEW_NAME = "template";
private final Configuration configuration;
private final View view;
@ -115,6 +116,10 @@ public final class ViewContext {
return this.view;
}
public boolean isTemplateView() {
return TEMPLATE_VIEW_NAME.equals(this.view.name);
}
public Collection<ConfigurationAttribute> getChildAttributes(final Long id) {
return this.attributeMapping.childAttributeMapping.get(id);
}
@ -127,6 +132,8 @@ public final class ViewContext {
return this.attributeMapping.getAttribute(attributeId);
}
public Long getAttributeIdByName(final String name) {
return this.attributeMapping.attributeNameIdMapping.get(name);
}
@ -338,4 +345,5 @@ public final class ViewContext {
values.forEach(this.inputFieldMapping::remove);
}
}

View file

@ -128,6 +128,7 @@ public class WidgetFactory {
ARCHIVE("archive.png"),
SEARCH("lens.png"),
UNDO("undo.png"),
RESET("reset.png"),
COLOR("color.png"),
USER("user.png"),
INSTITUTION("institution.png"),

View file

@ -2013,10 +2013,11 @@ sebserver.configtemplate.action.error.title=Action Failed
sebserver.configtemplate.action.error.noview.message=This setting has no default view<br/>and cannot be attached/detached from a view
sebserver.configtemplate.attr.list.actions=
sebserver.configtemplate.attr.list.actions.modify=Edit Attribute
sebserver.configtemplate.attr.list.actions.setdefault=Set Default Values
sebserver.configtemplate.attr.list.actions.setdefault=Reset to default values
sebserver.configtemplate.attr.list.actions.removeview=Remove From View
sebserver.configtemplate.attr.list.actions.attach-default-view=Attach To View
sebserver.configtemplate.attr.info.pleaseSelect=At first please select an Attribute from the list
sebserver.configtemplate.attr.list.actions.setdefault.confirm=Are you sure you want to reset this setting to overall default value?
sebserver.configtemplate.attr.form.title=Configuration Template Attribute
@ -2032,7 +2033,7 @@ sebserver.configtemplate.attr.form.group.tooltip=The group on the view/tab where
sebserver.configtemplate.attr.form.value=Configuration Template Attribute Value
sebserver.configtemplate.attr.form.value.tooltip=The SEB exam configuration attribute value that can be set as default for this template
sebserver.configtemplate.attr.action.setdefault=Set Default Values
sebserver.configtemplate.attr.action.setdefault=Reset to default values
sebserver.configtemplate.attr.action.template=View Configuration Template
sebserver.configtemplate.action.delete=Delete Configuration Template

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B