From 2bead4a52aae5cf3042ec3c3574fc4ff15ae3989 Mon Sep 17 00:00:00 2001 From: anhefti Date: Tue, 6 Apr 2021 18:44:36 +0200 Subject: [PATCH] SEBSERV-148 GUI Exam Config impl --- .../examconfig/impl/AttributeMapping.java | 32 ++++ .../impl/CellFieldBuilderAdapter.java | 139 ++++++++++++++++ .../impl/SingleSelectionFieldBuilder.java | 8 - .../service/examconfig/impl/ViewContext.java | 4 + .../examconfig/impl/ViewGridBuilder.java | 87 ++++++++-- .../gui/service/i18n/PolyglotPageService.java | 16 ++ .../i18n/impl/PolyglotPageServiceImpl.java | 33 ++++ .../proctoring/ZoomWindowScriptResolver.java | 149 ++---------------- .../sebserver/gui/widget/WidgetFactory.java | 29 ++++ .../proctoring/ZoomRoomRequestResponse.java | 8 +- .../ethz/seb/sebserver/gbl/util/ReplTest.java | 5 + 11 files changed, 347 insertions(+), 163 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/AttributeMapping.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/AttributeMapping.java index 0c2d25a6..4a0927da 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/AttributeMapping.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/AttributeMapping.java @@ -17,13 +17,18 @@ import java.util.function.Function; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute; import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation; import ch.ethz.seb.sebserver.gbl.util.Utils; +import ch.ethz.seb.sebserver.gui.service.examconfig.impl.CellFieldBuilderAdapter.ExpandBarCellFieldBuilderAdapter; public class AttributeMapping { + private static final Logger log = LoggerFactory.getLogger(AttributeMapping.class); + public final Long templateId; public final Map attributeIdMapping; @@ -148,6 +153,33 @@ public class AttributeMapping { .collect(Collectors.toSet()); } + public Collection getOrientationsOfExpandable(final ConfigurationAttribute attribute) { + final Orientation orientation = this.orientationAttributeMapping.get(attribute.id); + if (orientation == null) { + return Collections.emptyList(); + } + + if (StringUtils.isBlank(orientation.groupId)) { + return Collections.emptyList(); + } + + final String expandGroupKey = ExpandBarCellFieldBuilderAdapter.getExpandGroupKey(orientation.groupId); + if (expandGroupKey == null) { + return Collections.emptyList(); + } + + try { + return Collections.unmodifiableCollection(this.orientationAttributeMapping + .values() + .stream() + .filter(o -> o.groupId != null && o.groupId.contains(expandGroupKey)) + .collect(Collectors.toList())); + } catch (final Exception e) { + log.error("Failed to verify expandable identifier from group identifier", e); + return Collections.emptyList(); + } + } + public Collection getOrientationsOfGroup(final ConfigurationAttribute attribute) { final Orientation orientation = this.orientationAttributeMapping.get(attribute.id); if (orientation == null) { diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java index 5f497969..adb4763a 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/CellFieldBuilderAdapter.java @@ -8,13 +8,22 @@ package ch.ethz.seb.sebserver.gui.service.examconfig.impl; +import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.ExpandBar; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; +import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute; import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation; import ch.ethz.seb.sebserver.gbl.model.sebconfig.TitleOrientation; @@ -222,4 +231,134 @@ interface CellFieldBuilderAdapter { groupBuilder.compose(); } } + + class ExpandBarCellFieldBuilderAdapter implements CellFieldBuilderAdapter { + + public final static Pattern EXPAND_BAR_GROUP_PATTERN = Pattern.compile("\\[(.*?)\\]"); + + final Map> orientationsOfExpandBar; + + int x = 100; + int y = 100; + int width = 1; + int height = 1; + + public static final String getExpandKey(final String groupId) { + final Matcher matcher = EXPAND_BAR_GROUP_PATTERN.matcher(groupId); + if (matcher.find()) { + String expandableGroup = matcher.group(); + expandableGroup = expandableGroup.substring(1, expandableGroup.length() - 1); + return expandableGroup; + } + + return null; + } + + public static final String getExpandGroupKey(final String groupId) { + String expandKey = getExpandKey(groupId); + if (expandKey == null) { + if (StringUtils.isNotBlank(groupId) && groupId.contains(Constants.EMBEDDED_LIST_SEPARATOR)) { + expandKey = groupId; + } else { + return null; + } + } + + final String[] split = StringUtils.split(expandKey, Constants.EMBEDDED_LIST_SEPARATOR); + if (split != null && split.length > 0) { + return split[0]; + } + + return null; + } + + public static final String getExpandItemKey(final String groupId) { + String expandKey = getExpandKey(groupId); + if (expandKey == null) { + if (StringUtils.isNotBlank(groupId) && groupId.contains(Constants.EMBEDDED_LIST_SEPARATOR)) { + expandKey = groupId; + } else { + return null; + } + } + + final String[] split = StringUtils.split(expandKey, Constants.EMBEDDED_LIST_SEPARATOR); + if (split != null && split.length > 1) { + return split[1]; + } + + return null; + } + + ExpandBarCellFieldBuilderAdapter(final Collection orientationsOfExpandBar) { + this.orientationsOfExpandBar = new HashMap<>(); + + for (final Orientation o : orientationsOfExpandBar) { + final String expandKey = getExpandKey(o.groupId); + if (expandKey == null) { + continue; + } + + this.orientationsOfExpandBar + .computeIfAbsent(expandKey, key -> new ArrayList<>()) + .add(o); + + final int xpos = o.xPosition - ((o.title == TitleOrientation.LEFT) ? 1 : 0); + this.x = Math.min(xpos, this.x); + final int ypos = o.yPosition - ((o.title == TitleOrientation.TOP) ? 1 : 0); + this.y = Math.min(ypos, this.y); + this.width = Math.max(this.width, o.xpos() + o.width()); + this.height = Math.max(this.height, o.ypos() + o.height()); + } + + this.width = this.width - this.x; + this.height = this.height - this.y + 1; + } + + @Override + public void createCell(final ViewGridBuilder builder) { + final WidgetFactory widgetFactory = builder.examConfigurationService.getWidgetFactory(); + final LocTextKey expandTooltipText = this.orientationsOfExpandBar + .keySet() + .stream() + .findFirst() + .map(key -> { + final String expandGroupKey = getExpandGroupKey(key); + return new LocTextKey( + ExamConfigurationService.TOOL_TIP_SUFFIX + expandGroupKey, + expandGroupKey); + }).orElse(null); + + final ExpandBar expandBar = widgetFactory.expandBarLocalized( + builder.parent, + expandTooltipText); + expandBar.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, this.width, this.height)); + + for (final Map.Entry> entry : this.orientationsOfExpandBar.entrySet()) { + + final String expandItemKey = getExpandItemKey(entry.getKey()); + final Collection value = entry.getValue(); + final LocTextKey labelKey = new LocTextKey( + ExamConfigurationService.GROUP_LABEL_LOC_TEXT_PREFIX + expandItemKey, + expandItemKey); + + final Composite expandItem = widgetFactory.expandItemLocalized( + expandBar, + this.width, + labelKey); + + final ViewGridBuilder expandBuilder = new ViewGridBuilder( + expandItem, + builder.viewContext, + this, + builder.examConfigurationService); + + for (final Orientation orientation : value) { + final ConfigurationAttribute attribute = builder.viewContext.getAttribute(orientation.attributeId); + expandBuilder.add(attribute); + } + expandBuilder.compose(); + } + } + } } \ No newline at end of file diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/SingleSelectionFieldBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/SingleSelectionFieldBuilder.java index fd351acc..335c5c5c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/SingleSelectionFieldBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/SingleSelectionFieldBuilder.java @@ -112,14 +112,6 @@ public class SingleSelectionFieldBuilder extends SelectionFieldBuilder implement protected void setValueToControl(final String value) { this.control.select(value); } - - @Override - public String getReadableValue() { - - // TODO Auto-generated method stub - return super.getReadableValue(); - } - } } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewContext.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewContext.java index bce56121..607249e7 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewContext.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewContext.java @@ -132,6 +132,10 @@ public final class ViewContext { return this.attributeMapping.getOrientationsOfGroup(attribute); } + public Collection getOrientationsOfExpandable(final ConfigurationAttribute attribute) { + return this.attributeMapping.getOrientationsOfExpandable(attribute); + } + public Orientation getOrientation(final Long attributeId) { return this.attributeMapping.getOrientation(attributeId); } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java index 3584d427..4c20a11b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/examconfig/impl/ViewGridBuilder.java @@ -26,6 +26,7 @@ import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute; import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation; import ch.ethz.seb.sebserver.gui.service.examconfig.ExamConfigurationService; import ch.ethz.seb.sebserver.gui.service.examconfig.InputFieldBuilder; +import ch.ethz.seb.sebserver.gui.service.examconfig.impl.CellFieldBuilderAdapter.ExpandBarCellFieldBuilderAdapter; import ch.ethz.seb.sebserver.gui.service.examconfig.impl.CellFieldBuilderAdapter.GroupCellFieldBuilderAdapter; public class ViewGridBuilder { @@ -37,8 +38,13 @@ public class ViewGridBuilder { final ViewContext viewContext; private final CellFieldBuilderAdapter[][] grid; - private final GroupCellFieldBuilderAdapter groupBuilderAdapter; private final Set registeredGroups; + private final Set registeredExpandables; + + private final boolean isGroupBuilder; + private final boolean isExpandBarBuilder; + private final int xOffset; + private final int yOffset; ViewGridBuilder( final Composite parent, @@ -49,8 +55,14 @@ public class ViewGridBuilder { this.parent = parent; this.viewContext = viewContext; this.grid = new CellFieldBuilderAdapter[viewContext.getRows()][viewContext.getColumns()]; - this.groupBuilderAdapter = null; this.registeredGroups = new HashSet<>(); + this.registeredExpandables = new HashSet<>(); + + this.isGroupBuilder = false; + this.isExpandBarBuilder = false; + this.xOffset = 0; + this.yOffset = 0; + } ViewGridBuilder( @@ -62,9 +74,31 @@ public class ViewGridBuilder { this.examConfigurationService = examConfigurationService; this.parent = parent; this.viewContext = viewContext; - this.groupBuilderAdapter = groupBuilderAdapter; + this.isGroupBuilder = true; + this.isExpandBarBuilder = false; + this.xOffset = groupBuilderAdapter.x; + this.yOffset = groupBuilderAdapter.y; this.grid = new CellFieldBuilderAdapter[groupBuilderAdapter.height - 1][groupBuilderAdapter.width]; this.registeredGroups = null; + this.registeredExpandables = null; + } + + ViewGridBuilder( + final Composite parent, + final ViewContext viewContext, + final ExpandBarCellFieldBuilderAdapter expandBarBuilderAdapter, + final ExamConfigurationService examConfigurationService) { + + this.examConfigurationService = examConfigurationService; + this.parent = parent; + this.viewContext = viewContext; + this.isGroupBuilder = false; + this.isExpandBarBuilder = true; + this.xOffset = expandBarBuilderAdapter.x; + this.yOffset = expandBarBuilderAdapter.y; + this.grid = new CellFieldBuilderAdapter[expandBarBuilderAdapter.height - 1][expandBarBuilderAdapter.width]; + this.registeredGroups = new HashSet<>(); + this.registeredExpandables = null; } ViewGridBuilder add(final ConfigurationAttribute attribute) { @@ -84,24 +118,49 @@ public class ViewGridBuilder { final Orientation orientation = this.viewContext .getOrientation(attribute.id); - // create group if this is not a group builder - if (this.groupBuilderAdapter == null && StringUtils.isNotBlank(orientation.groupId)) { - if (this.registeredGroups.contains(orientation.groupId)) { + // create group builder + if (StringUtils.isNotBlank(orientation.groupId)) { + + final String expandGroupKey = ExpandBarCellFieldBuilderAdapter.getExpandGroupKey(orientation.groupId); + if (!this.isExpandBarBuilder && !this.isGroupBuilder && expandGroupKey != null) { + if (this.registeredExpandables.contains(expandGroupKey)) { + return this; + } + + final ExpandBarCellFieldBuilderAdapter groupBuilder = + new ExpandBarCellFieldBuilderAdapter(this.viewContext.getOrientationsOfExpandable(attribute)); + + fillDummy(groupBuilder.x, groupBuilder.y, groupBuilder.width, groupBuilder.height); + this.grid[groupBuilder.y][groupBuilder.x] = groupBuilder; + this.registeredExpandables.add(expandGroupKey); return this; } - final GroupCellFieldBuilderAdapter groupBuilder = - new GroupCellFieldBuilderAdapter(this.viewContext.getOrientationsOfGroup(attribute)); + if (!this.isGroupBuilder) { + if (this.registeredGroups.contains(orientation.groupId)) { + return this; + } - fillDummy(groupBuilder.x, groupBuilder.y, groupBuilder.width, groupBuilder.height); - this.grid[groupBuilder.y][groupBuilder.x] = groupBuilder; - this.registeredGroups.add(orientation.groupId); - return this; + final GroupCellFieldBuilderAdapter groupBuilder = + new GroupCellFieldBuilderAdapter(this.viewContext.getOrientationsOfGroup(attribute)); + + final int xpos = groupBuilder.x - this.xOffset; + final int ypos = groupBuilder.y - this.yOffset; + + fillDummy(xpos, ypos, groupBuilder.width, groupBuilder.height); + this.grid[ypos][xpos] = groupBuilder; + this.registeredGroups.add(orientation.groupId); + return this; + } + } + + if (this.isExpandBarBuilder) { + System.out.print("**************** attr:" + attribute.name); } // create single input field with label - final int xpos = orientation.xpos() + ((this.groupBuilderAdapter != null) ? -this.groupBuilderAdapter.x : 0); - final int ypos = orientation.ypos() + ((this.groupBuilderAdapter != null) ? -this.groupBuilderAdapter.y : 0); + final int xpos = orientation.xpos() - this.xOffset; + final int ypos = orientation.ypos() - this.yOffset; if (orientation.width > 1 || orientation.height > 1) { fillDummy(xpos, ypos, orientation.width, orientation.height); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/PolyglotPageService.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/PolyglotPageService.java index 903503af..cdafe5d9 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/PolyglotPageService.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/PolyglotPageService.java @@ -13,6 +13,8 @@ import java.util.Locale; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.ExpandBar; +import org.eclipse.swt.widgets.ExpandItem; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.TabFolder; @@ -79,6 +81,20 @@ public interface PolyglotPageService { * @param locTooltipKey the localized text key for the tool-tip to inject */ void injectI18n(Group group, LocTextKey locTextKey, LocTextKey locTooltipKey); + /** Used to inject a localized text within the given Control (Widget) that automatically gets changed on language + * change. + * + * @param expandBar the ExpandBar instance + * @param locTooltipKey the localized text key for the tool-tip to inject */ + void injectI18n(ExpandBar expandBar, LocTextKey locTooltipKey); + + /** Used to inject a localized text within the given Control (Widget) that automatically gets changed on language + * change. + * + * @param expandItem the ExpandItem instance + * @param locTextKey the localized text key to inject */ + void injectI18n(ExpandItem expandItem, LocTextKey locTextKey); + /** Used to inject a localized text within the given Control (Widget) that automatically gets changed on language * change. * diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java index cc515eed..5adb881e 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/i18n/impl/PolyglotPageServiceImpl.java @@ -17,6 +17,8 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.ExpandBar; +import org.eclipse.swt.widgets.ExpandItem; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.TabFolder; @@ -105,6 +107,24 @@ public final class PolyglotPageServiceImpl implements PolyglotPageService { groupFunction.accept(group); } + @Override + public void injectI18n(final ExpandBar expandBar, final LocTextKey locTooltipKey) { + expandBar.setData( + POLYGLOT_WIDGET_FUNCTION_KEY, + (Consumer) _expandBar -> { + if (locTooltipKey != null) { + _expandBar.setToolTipText(this.i18nSupport.getText(locTooltipKey)); + } + updateLocale(_expandBar.getItems(), this.i18nSupport); + }); + } + + @Override + public void injectI18n(final ExpandItem expandItem, final LocTextKey locTextKey) { + expandItem.setData(POLYGLOT_ITEM_TEXT_DATA_KEY, locTextKey); + expandItem.setText(this.i18nSupport.getText(locTextKey)); + } + @Override public void injectI18n(final Button button, final LocTextKey locTextKey) { injectI18n(button, locTextKey, null); @@ -279,6 +299,19 @@ public final class PolyglotPageServiceImpl implements PolyglotPageService { } } + private static void updateLocale(final ExpandItem[] items, final I18nSupport i18nSupport) { + if (items == null) { + return; + } + + for (final ExpandItem childItem : items) { + final LocTextKey locTextKey = (LocTextKey) childItem.getData(POLYGLOT_ITEM_TEXT_DATA_KEY); + if (locTextKey != null) { + childItem.setText(i18nSupport.getText(locTextKey)); + } + } + } + private static void updateLocale(final TableColumn[] columns, final I18nSupport i18nSupport) { if (columns == null) { return; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/proctoring/ZoomWindowScriptResolver.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/proctoring/ZoomWindowScriptResolver.java index 127fe5b8..61d88db1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/proctoring/ZoomWindowScriptResolver.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/proctoring/ZoomWindowScriptResolver.java @@ -90,7 +90,7 @@ public class ZoomWindowScriptResolver implements ProctoringWindowScriptResolver + " audioPanelAlwaysOpen: true, //optional\n" + " showPureSharingContent: false, //optional\n" + " isSupportAV: true, //optional,\n" - + " isSupportChat: false, //optional,\n" + + " isSupportChat: true, //optional,\n" + " isSupportQA: true, //optional,\n" + " isSupportCC: true, //optional,\n" + " screenShare: true, //optional,\n" @@ -106,16 +106,15 @@ public class ZoomWindowScriptResolver implements ProctoringWindowScriptResolver + " width: 400,\n" + " height: 380\n" + " },\n" - + " // meetingInfo: [ // optional\n" - + " // 'topic',\n" - + " // 'host',\n" - + " // 'mn',\n" - + " // 'pwd',\n" - + " // 'telPwd',\n" - + " // 'invite',\n" - + " // 'participant',\n" - + " // 'dc'\n" - + " // ],\n" + + " meetingInfo: [ // optional\n" + + " 'topic',\n" + + " 'host',\n" + + " 'mn',\n" + + " 'pwd',\n" + + " 'invite',\n" + + " 'participant',\n" + + " 'dc'\n" + + " ],\n" + " disableVoIP: false, // optional\n" + " disableReport: false, // optional\n" + " error: function (res) {\n" @@ -145,134 +144,6 @@ public class ZoomWindowScriptResolver implements ProctoringWindowScriptResolver + ""; // @formatter:on -// // @formatter:off -// private static final String TEST_ZOOM_WINDOW_HTML = -// "\n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + " \n" -// + ""; -// // @formatter:on - @Override public boolean applies(final ProctoringWindowData data) { try { diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java b/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java index 2a9a92f6..87ae7b4b 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/widget/WidgetFactory.java @@ -30,6 +30,8 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.ColorDialog; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.DateTime; +import org.eclipse.swt.widgets.ExpandBar; +import org.eclipse.swt.widgets.ExpandItem; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; @@ -522,6 +524,33 @@ public class WidgetFactory { return group; } + public ExpandBar expandBarLocalized( + final Composite parent, + final LocTextKey locTooltipKey) { + + final ExpandBar expandBar = new ExpandBar(parent, SWT.NONE); + this.polyglotPageService.injectI18n(expandBar, locTooltipKey); + return expandBar; + } + + public Composite expandItemLocalized( + final ExpandBar parent, + final int columns, + final LocTextKey locTextKey) { + + final ExpandItem expandItem = new ExpandItem(parent, SWT.NONE); + final Composite body = new Composite(expandItem.getParent(), SWT.NONE); + final GridLayout gridLayout = new GridLayout(columns, true); + gridLayout.verticalSpacing = 0; + gridLayout.horizontalSpacing = 0; + gridLayout.marginHeight = 0; + body.setLayout(gridLayout); + expandItem.setControl(body); + + this.polyglotPageService.injectI18n(expandItem, locTextKey); + return body; + } + public Tree treeLocalized(final Composite parent, final int style) { final Tree tree = new Tree(parent, style); this.polyglotPageService.injectI18n(tree); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomRoomRequestResponse.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomRoomRequestResponse.java index 1d79fb06..99daff85 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomRoomRequestResponse.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/proctoring/ZoomRoomRequestResponse.java @@ -113,13 +113,17 @@ public interface ZoomRoomRequestResponse { @JsonIgnoreProperties(ignoreUnknown = true) static class CreateMeetingRequest { @JsonProperty final String topic; - @JsonProperty final int type = 2; // Scheduled Meeting - @JsonProperty final String start_time = DateTime.now(DateTimeZone.UTC).toString("yyyy-MM-dd'T'HH:mm:ss"); + @JsonProperty final int type; + @JsonProperty final String start_time; + @JsonProperty final String timezone; @JsonProperty final int duration = 60; @JsonProperty final CharSequence password; @JsonProperty final Settings settings; public CreateMeetingRequest(final String topic, final CharSequence password) { + this.type = 2; // Scheduled Meeting + this.start_time = DateTime.now(DateTimeZone.UTC).toString("yyyy-MM-dd'T'HH:mm:ss"); + this.timezone = DateTimeZone.UTC.getID(); this.topic = topic; this.password = password; this.settings = new Settings(); diff --git a/src/test/java/ch/ethz/seb/sebserver/gbl/util/ReplTest.java b/src/test/java/ch/ethz/seb/sebserver/gbl/util/ReplTest.java index 12c5ed74..c5918f0f 100644 --- a/src/test/java/ch/ethz/seb/sebserver/gbl/util/ReplTest.java +++ b/src/test/java/ch/ethz/seb/sebserver/gbl/util/ReplTest.java @@ -24,4 +24,9 @@ public class ReplTest { // assertEquals("", meetingPwd); // } +// @Test +// public void testTimezone() { +// assertEquals("", DateTimeZone.UTC.getID()); +// } + }