SEBSERV-148 GUI Exam Config impl
This commit is contained in:
parent
a7fca8785e
commit
2bead4a52a
11 changed files with 347 additions and 163 deletions
|
@ -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<Long, ConfigurationAttribute> attributeIdMapping;
|
||||
|
@ -148,6 +153,33 @@ public class AttributeMapping {
|
|||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public Collection<Orientation> 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<Orientation> getOrientationsOfGroup(final ConfigurationAttribute attribute) {
|
||||
final Orientation orientation = this.orientationAttributeMapping.get(attribute.id);
|
||||
if (orientation == null) {
|
||||
|
|
|
@ -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<String, Collection<Orientation>> 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<Orientation> 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<String, Collection<Orientation>> entry : this.orientationsOfExpandBar.entrySet()) {
|
||||
|
||||
final String expandItemKey = getExpandItemKey(entry.getKey());
|
||||
final Collection<Orientation> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -132,6 +132,10 @@ public final class ViewContext {
|
|||
return this.attributeMapping.getOrientationsOfGroup(attribute);
|
||||
}
|
||||
|
||||
public Collection<Orientation> getOrientationsOfExpandable(final ConfigurationAttribute attribute) {
|
||||
return this.attributeMapping.getOrientationsOfExpandable(attribute);
|
||||
}
|
||||
|
||||
public Orientation getOrientation(final Long attributeId) {
|
||||
return this.attributeMapping.getOrientation(attributeId);
|
||||
}
|
||||
|
|
|
@ -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<String> registeredGroups;
|
||||
private final Set<String> 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);
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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>) _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;
|
||||
|
|
|
@ -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
|
|||
+ "</html>";
|
||||
// @formatter:on
|
||||
|
||||
// // @formatter:off
|
||||
// private static final String TEST_ZOOM_WINDOW_HTML =
|
||||
// "<html>\n"
|
||||
// + " <head>\n"
|
||||
// + " <meta charset=\"utf-8\" />\n"
|
||||
// + " <link type=\"text/css\" rel=\"stylesheet\" href=\"https://source.zoom.us/1.9.0/css/bootstrap.css\" />\n"
|
||||
// + " <link type=\"text/css\" rel=\"stylesheet\" href=\"https://source.zoom.us/1.9.0/css/react-select.css\" />\n"
|
||||
// + " </head>\n"
|
||||
// + " <body>\n"
|
||||
// + " <script src=\"https://source.zoom.us/1.9.0/lib/vendor/react.min.js\"></script>\n"
|
||||
// + " <script src=\"https://source.zoom.us/1.9.0/lib/vendor/react-dom.min.js\"></script>\n"
|
||||
// + " <script src=\"https://source.zoom.us/1.9.0/lib/vendor/redux.min.js\"></script>\n"
|
||||
// + " <script src=\"https://source.zoom.us/1.9.0/lib/vendor/redux-thunk.min.js\"></script>\n"
|
||||
// + " <script src=\"https://source.zoom.us/1.9.0/lib/vendor/jquery.min.js\"></script>\n"
|
||||
// + " <script src=\"https://source.zoom.us/1.9.0/lib/vendor/lodash.min.js\"></script>\n"
|
||||
// + " <script src=\"https://source.zoom.us/zoom-meeting-1.9.0.min.js\"></script>\n"
|
||||
// + " <script src=\"https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9/crypto-js.min.js\"></script>\n"
|
||||
// + " <script type=\"text/javascript\">\n"
|
||||
// + "\n"
|
||||
// + " console.log(\"Checking system requirements...\");\n"
|
||||
// + " console.log(JSON.stringify(ZoomMtg.checkSystemRequirements()));\n"
|
||||
// + "\n"
|
||||
// + " console.log(\"Initializing Zoom...\");\n"
|
||||
// + " ZoomMtg.setZoomJSLib('https://source.zoom.us/1.9.0/lib', '/av');\n"
|
||||
// + " ZoomMtg.preLoadWasm();\n"
|
||||
// + " ZoomMtg.prepareJssdk();\n"
|
||||
// + "\n"
|
||||
// + "const API_KEY = \"wX6KmZetQgeYqJix3W7Vtw\";\r\n"
|
||||
// + "const API_SECRET = \"PoxjA08IGIO5X3m8iDxZcti0c0VtQL9DenZU\";\r\n"
|
||||
// + "\r\n"
|
||||
// + "console.log(\"Checking system requirements...\");\r\n"
|
||||
// + "console.log(JSON.stringify(ZoomMtg.checkSystemRequirements()));\r\n"
|
||||
// + "\r\n"
|
||||
// + "console.log(\"Initializing Zoom...\");\r\n"
|
||||
// + "ZoomMtg.setZoomJSLib('https://source.zoom.us/1.9.0/lib', '/av');\r\n"
|
||||
// + "ZoomMtg.preLoadWasm();\r\n"
|
||||
// + "ZoomMtg.prepareJssdk();\r\n"
|
||||
// + "\r\n"
|
||||
// + "const config = {\r\n"
|
||||
// + " meetingNumber: %%_" + ATTR_ROOM_NAME + "_%%,\r\n"
|
||||
// + " leaveUrl: 'https://google.ch',\r\n"
|
||||
// + " userName: 'Firstname Lastname',\r\n"
|
||||
// + " userEmail: 'firstname.lastname@yoursite.com',\r\n"
|
||||
// + " /* passWord: 'password', // if required */\r\n"
|
||||
// + " role: 0 // 1 for host; 0 for attendee\r\n"
|
||||
// + "};\r\n"
|
||||
// + "\r\n"
|
||||
// + "const signature = ZoomMtg.generateSignature({\r\n"
|
||||
// + " meetingNumber: config.meetingNumber,\r\n"
|
||||
// + " apiKey: API_KEY,\r\n"
|
||||
// + " apiSecret: API_SECRET,\r\n"
|
||||
// + " role: config.role,\r\n"
|
||||
// + " error: function (res) {\r\n"
|
||||
// + " console.error(\"FAILED TO GENERATE SIGNATURE: \" + res)\r\n"
|
||||
// + " },\r\n"
|
||||
// + " success: function (res) {\r\n"
|
||||
// + " console.log(\"Successfully generated signature.\");\r\n"
|
||||
// + " console.log(res.result);\r\n"
|
||||
// + " },\r\n"
|
||||
// + "});\r\n"
|
||||
// + "\r\n"
|
||||
// + "console.log(\"Initializing meeting...\");\r\n"
|
||||
// + "console.log(\"signature: \" + signature);\r\n"
|
||||
// + "\r\n"
|
||||
// + "// See documentation: https://zoom.github.io/sample-app-web/ZoomMtg.html#init\r\n"
|
||||
// + "ZoomMtg.init({\r\n"
|
||||
// + " debug: true, //optional\r\n"
|
||||
// + " leaveUrl: config.leaveUrl, //required\r\n"
|
||||
// + " // webEndpoint: 'PSO web domain', // PSO option\r\n"
|
||||
// + " showMeetingHeader: true, //option\r\n"
|
||||
// + " disableInvite: false, //optional\r\n"
|
||||
// + " disableCallOut: false, //optional\r\n"
|
||||
// + " disableRecord: false, //optional\r\n"
|
||||
// + " disableJoinAudio: false, //optional\r\n"
|
||||
// + " audioPanelAlwaysOpen: true, //optional\r\n"
|
||||
// + " showPureSharingContent: false, //optional\r\n"
|
||||
// + " isSupportAV: true, //optional,\r\n"
|
||||
// + " isSupportChat: false, //optional,\r\n"
|
||||
// + " isSupportQA: true, //optional,\r\n"
|
||||
// + " isSupportCC: true, //optional,\r\n"
|
||||
// + " screenShare: true, //optional,\r\n"
|
||||
// + " rwcBackup: '', //optional,\r\n"
|
||||
// + " videoDrag: true, //optional,\r\n"
|
||||
// + " sharingMode: 'both', //optional,\r\n"
|
||||
// + " videoHeader: true, //optional,\r\n"
|
||||
// + " isLockBottom: true, // optional,\r\n"
|
||||
// + " isSupportNonverbal: true, // optional,\r\n"
|
||||
// + " isShowJoiningErrorDialog: true, // optional,\r\n"
|
||||
// + " inviteUrlFormat: '', // optional\r\n"
|
||||
// + " loginWindow: { // optional,\r\n"
|
||||
// + " width: 400,\r\n"
|
||||
// + " height: 380\r\n"
|
||||
// + " },\r\n"
|
||||
// + " // meetingInfo: [ // optional\r\n"
|
||||
// + " // 'topic',\r\n"
|
||||
// + " // 'host',\r\n"
|
||||
// + " // 'mn',\r\n"
|
||||
// + " // 'pwd',\r\n"
|
||||
// + " // 'telPwd',\r\n"
|
||||
// + " // 'invite',\r\n"
|
||||
// + " // 'participant',\r\n"
|
||||
// + " // 'dc'\r\n"
|
||||
// + " // ],\r\n"
|
||||
// + " disableVoIP: false, // optional\r\n"
|
||||
// + " disableReport: false, // optional\r\n"
|
||||
// + " error: function(res) {\r\n"
|
||||
// + " console.warn(\"INIT ERROR\")\r\n"
|
||||
// + " console.log(res)\r\n"
|
||||
// + " },\r\n"
|
||||
// + " success: function() {\r\n"
|
||||
// + " ZoomMtg.join({\r\n"
|
||||
// + " signature: signature,\r\n"
|
||||
// + " apiKey: API_KEY,\r\n"
|
||||
// + " meetingNumber: config.meetingNumber,\r\n"
|
||||
// + " userName: config.userName,\r\n"
|
||||
// + " passWord: '%%_" + ATTR_ROOM_KEY + "_%%',\r\n"
|
||||
// + " error(res) {\r\n"
|
||||
// + " console.warn(\"JOIN ERROR\")\r\n"
|
||||
// + " console.log(res)\r\n"
|
||||
// + " }\r\n"
|
||||
// + " })\r\n"
|
||||
// + " }\r\n"
|
||||
// + "})\n"
|
||||
// + " </script>\n"
|
||||
// + " </body>\n"
|
||||
// + "</html>";
|
||||
// // @formatter:on
|
||||
|
||||
@Override
|
||||
public boolean applies(final ProctoringWindowData data) {
|
||||
try {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -24,4 +24,9 @@ public class ReplTest {
|
|||
// assertEquals("", meetingPwd);
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// public void testTimezone() {
|
||||
// assertEquals("", DateTimeZone.UTC.getID());
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue