Merge remote-tracking branch 'origin/master'

This commit is contained in:
anhefti 2020-02-24 12:43:12 +01:00
commit 7d982bafe2
13 changed files with 59 additions and 81 deletions

View file

@ -18,7 +18,7 @@
<packaging>jar</packaging>
<properties>
<sebserver-version>0.5.4-beta</sebserver-version>
<sebserver-version>0.6.0-rc</sebserver-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

View file

@ -10,8 +10,6 @@ package ch.ethz.seb.sebserver.gui.content;
import java.util.Collection;
import ch.ethz.seb.sebserver.gbl.model.session.ExtendedClientEvent;
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.GetExtendedClientEventPage;
import org.eclipse.swt.widgets.Composite;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
@ -27,6 +25,7 @@ import ch.ethz.seb.sebserver.gbl.model.exam.Indicator;
import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection.ConnectionStatus;
import ch.ethz.seb.sebserver.gbl.model.session.ClientConnectionData;
import ch.ethz.seb.sebserver.gbl.model.session.ClientEvent;
import ch.ethz.seb.sebserver.gbl.model.session.ExtendedClientEvent;
import ch.ethz.seb.sebserver.gbl.model.user.UserRole;
import ch.ethz.seb.sebserver.gbl.profile.GuiProfile;
import ch.ethz.seb.sebserver.gbl.util.Utils;
@ -43,6 +42,7 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestService;
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetExam;
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.exam.GetIndicators;
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.logs.GetExtendedClientEventPage;
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.session.GetClientConnectionData;
import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.CurrentUser;
import ch.ethz.seb.sebserver.gui.service.session.ClientConnectionDetails;
@ -172,13 +172,12 @@ public class MonitoringClientConnection implements TemplateComposer {
CustomVariant.TEXT_H3,
EVENT_LIST_TITLE_KEY);
PageService.PageActionBuilder actionBuilder = this.pageService
final PageService.PageActionBuilder actionBuilder = this.pageService
.pageActionBuilder(
pageContext
.clearAttributes()
.clearEntityKeys());
// client event table for this connection
this.pageService.entityTableBuilder(restService.getRestCall(GetExtendedClientEventPage.class))
.withEmptyMessage(EMPTY_LIST_TEXT_KEY)
@ -228,13 +227,13 @@ public class MonitoringClientConnection implements TemplateComposer {
.withDefaultAction(t -> actionBuilder
.newAction(ActionDefinition.LOGS_SEB_CLIENT_SHOW_DETAILS)
.withExec(action -> sebClientLogDetailsPopup.showDetails(action, t.getSingleSelectedROWData()))
.withExec(action -> this.sebClientLogDetailsPopup.showDetails(action,
t.getSingleSelectedROWData()))
.noEventPropagation()
.create())
.compose(pageContext.copyOf(content));
actionBuilder
.newAction(ActionDefinition.MONITOR_EXAM_BACK_TO_OVERVIEW)
.withEntityKey(parentEntityKey)

View file

@ -8,7 +8,6 @@
package ch.ethz.seb.sebserver.gui.content;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@ -19,7 +18,6 @@ import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.client.service.UrlLauncher;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
@ -209,7 +207,6 @@ public class SebExamConfigPropForm implements TemplateComposer {
? this.restService.getRestCall(NewExamConfig.class)
: this.restService.getRestCall(SaveExamConfig.class));
final boolean settingsReadonly = examConfig.status == ConfigurationStatus.IN_USE;
final UrlLauncher urlLauncher = RWT.getClient().getService(UrlLauncher.class);
final PageContext actionContext = formContext.clearEntityKeys();
final PageActionBuilder actionBuilder = this.pageService.pageActionBuilder(actionContext);
@ -350,7 +347,8 @@ public class SebExamConfigPropForm implements TemplateComposer {
.newAction(ActionDefinition.EXAM_VIEW_FROM_LIST)
.withSelectionSupplier(() -> {
final ExamConfigurationMap selectedROWData = getSelectedExamMapping(table);
return new HashSet<>(Collections.singletonList(new EntityKey(selectedROWData.examId, EntityType.EXAM)));
return new HashSet<>(
Collections.singletonList(new EntityKey(selectedROWData.examId, EntityType.EXAM)));
})
.withExec(PageAction::applySingleSelectionAsEntityKey)
.create();

View file

@ -10,7 +10,6 @@ package ch.ethz.seb.sebserver.gui.form;
import java.util.function.BooleanSupplier;
import ch.ethz.seb.sebserver.gui.service.page.PageService;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.swt.SWT;
@ -21,6 +20,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
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.CustomVariant;
@ -132,7 +132,7 @@ public abstract class FieldBuilder<T> {
final boolean hasTooltip = (fieldBuilder.tooltip != null &&
StringUtils.isNotBlank(builder.i18nSupport.getText(fieldBuilder.tooltip, "")));
final Label label = labelLocalized(
labelLocalized(
builder.widgetFactory,
infoGrid,
fieldBuilder.label,
@ -149,16 +149,6 @@ public abstract class FieldBuilder<T> {
info.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
}
// if (fieldBuilder.tooltipKeyRight != null &&
// StringUtils.isNotBlank(builder.i18nSupport.getText(fieldBuilder.tooltipKeyRight, ""))) {
//
// final Label info = builder.widgetFactory.imageButton(
// WidgetFactory.ImageIcon.HELP,
// infoGrid,
// fieldBuilder.tooltipKeyRight);
// info.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
// }
if (fieldBuilder.isMandatory) {
final Label mandatory = builder.widgetFactory.imageButton(
WidgetFactory.ImageIcon.MANDATORY,

View file

@ -12,10 +12,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
import java.util.function.Supplier;
import ch.ethz.seb.sebserver.gbl.util.Cryptor;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@ -27,6 +25,7 @@ import org.slf4j.LoggerFactory;
import ch.ethz.seb.sebserver.gbl.model.Entity;
import ch.ethz.seb.sebserver.gbl.model.exam.Indicator;
import ch.ethz.seb.sebserver.gbl.util.Cryptor;
import ch.ethz.seb.sebserver.gbl.util.Tuple;
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;

View file

@ -8,6 +8,16 @@
package ch.ethz.seb.sebserver.gui.service.examconfig.impl;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import ch.ethz.seb.sebserver.gbl.model.sebconfig.AttributeType;
import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute;
import ch.ethz.seb.sebserver.gbl.model.sebconfig.Orientation;
@ -20,25 +30,12 @@ import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
import ch.ethz.seb.sebserver.gui.widget.PasswordInput;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory;
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
@Lazy
@Component
@GuiProfile
public class PasswordFieldBuilder implements InputFieldBuilder {
private static final Logger log = LoggerFactory.getLogger(PasswordFieldBuilder.class);
private static final LocTextKey VAL_CONFIRM_PWD_TEXT_KEY =
new LocTextKey("sebserver.examconfig.props.validation.password.confirm");
@ -76,11 +73,11 @@ public class PasswordFieldBuilder implements InputFieldBuilder {
final Composite innerGrid = InputFieldBuilder
.createInnerGrid(parent, attribute, orientation);
final PasswordInput passwordInput = new PasswordInput(innerGrid, widgetFactory);
final PasswordInput passwordInput = new PasswordInput(innerGrid, this.widgetFactory);
final GridData passwordInputLD = new GridData(SWT.FILL, SWT.FILL, true, true);
passwordInput.setLayoutData(passwordInputLD);
final PasswordInput confirmInput = new PasswordInput(innerGrid, widgetFactory);
final PasswordInput confirmInput = new PasswordInput(innerGrid, this.widgetFactory);
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
gridData.verticalIndent = 14;
confirmInput.setLayoutData(gridData);
@ -92,7 +89,7 @@ public class PasswordFieldBuilder implements InputFieldBuilder {
passwordInput,
confirmInput,
FieldBuilder.createErrorLabel(innerGrid),
cryptor);
this.cryptor);
if (viewContext.readonly) {
passwordInput.setEditable(false);
@ -157,7 +154,7 @@ public class PasswordFieldBuilder implements InputFieldBuilder {
@Override
protected void setValueToControl(final String value) {
if (StringUtils.isNotBlank(value)) {
CharSequence pwd = cryptor.decrypt(value);
final CharSequence pwd = this.cryptor.decrypt(value);
this.control.setValue(pwd.toString());
this.confirm.setValue(pwd.toString());
} else {
@ -170,7 +167,7 @@ public class PasswordFieldBuilder implements InputFieldBuilder {
public String getValue() {
final CharSequence pwd = this.control.getValue();
if (StringUtils.isNotBlank(pwd)) {
return cryptor.encrypt(pwd).toString();
return this.cryptor.encrypt(pwd).toString();
}
return StringUtils.EMPTY;

View file

@ -11,7 +11,6 @@ package ch.ethz.seb.sebserver.gui.service.i18n;
import java.util.Collection;
import java.util.Locale;
import org.eclipse.swt.widgets.Text;
import org.joda.time.DateTime;
import ch.ethz.seb.sebserver.gbl.util.Utils;
@ -180,8 +179,7 @@ public interface I18nSupport {
/** Indicates if there is a localized text defined for a specified LocTextKey
*
* @param locTextKey the LocTextKey instance
* @return true if there is a localized text defined for a specified LocTextKey, false otherwise
*/
* @return true if there is a localized text defined for a specified LocTextKey, false otherwise */
boolean hasText(LocTextKey locTextKey);
}

View file

@ -31,7 +31,6 @@ import ch.ethz.seb.sebserver.gui.service.ResourceService;
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
import ch.ethz.seb.sebserver.gui.service.page.PageContext;
import ch.ethz.seb.sebserver.gui.service.page.PageService;
import ch.ethz.seb.sebserver.gui.service.push.ServerPushContext;
import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.RestCall;
import ch.ethz.seb.sebserver.gui.service.session.IndicatorData.ThresholdColor;

View file

@ -26,7 +26,6 @@ import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import org.apache.tomcat.util.bcel.Const;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Rectangle;
@ -160,11 +159,10 @@ public final class ClientConnectionTable {
CONNECTION_STATUS_TEXT_KEY,
CONNECTION_STATUS_TOOLTIP_TEXT_KEY);
for (final Indicator indDef : indicators) {
TableColumn tableColumn = widgetFactory.tableColumnLocalized(
final TableColumn tableColumn = this.widgetFactory.tableColumnLocalized(
this.table,
new LocTextKey(INDICATOR_NAME_TEXT_KEY_PREFIX + indDef.name),
new LocTextKey(INDICATOR_NAME_TEXT_KEY_PREFIX + indDef.type.name)
);
new LocTextKey(INDICATOR_NAME_TEXT_KEY_PREFIX + indDef.type.name));
tableColumn.setText(indDef.name);
}
@ -256,7 +254,7 @@ public final class ClientConnectionTable {
}
}
public ClientConnectionTable withSelectionListener(Consumer<Set<EntityKey>> selectionListener) {
public ClientConnectionTable withSelectionListener(final Consumer<Set<EntityKey>> selectionListener) {
this.selectionListener = selectionListener;
return this;
}

View file

@ -14,8 +14,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import ch.ethz.seb.sebserver.gbl.util.Tuple3;
import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@ -26,6 +24,7 @@ import org.eclipse.swt.widgets.Listener;
import ch.ethz.seb.sebserver.gbl.Constants;
import ch.ethz.seb.sebserver.gbl.util.Tuple;
import ch.ethz.seb.sebserver.gbl.util.Tuple3;
import ch.ethz.seb.sebserver.gbl.util.Utils;
import ch.ethz.seb.sebserver.gui.service.page.PageService;
@ -72,7 +71,8 @@ public final class MultiSelectionCheckbox extends Composite implements Selection
});
this.checkboxes.put(tuple._1, button);
Tuple3<String> tuple3 = tuple.adaptTo(Tuple3.class);
@SuppressWarnings("unchecked")
final Tuple3<String> tuple3 = tuple.adaptTo(Tuple3.class);
if (tuple3 != null && StringUtils.isNotBlank(tuple3._3)) {
button.setToolTipText(tuple3._3);
}

View file

@ -8,9 +8,6 @@
package ch.ethz.seb.sebserver.gui.widget;
import ch.ethz.seb.sebserver.gbl.Constants;
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
import ch.ethz.seb.sebserver.gui.service.page.PageService;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.swt.SWT;
@ -21,12 +18,17 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import ch.ethz.seb.sebserver.gbl.Constants;
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
import ch.ethz.seb.sebserver.gui.service.page.PageService;
public class PasswordInput extends Composite {
private static final long serialVersionUID = 2228580383280478542L;
public static final LocTextKey PLAIN_TEXT_VIEW_TOOLTIP_KEY =
new LocTextKey("sebserver.overall.action.showPassword.tooltip");
private final Composite inputAnchor;
private final Label visibilityButton;
@ -45,24 +47,24 @@ public class PasswordInput extends Composite {
this.setLayout(gridLayout);
this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
inputAnchor = new Composite(this, SWT.NONE);
this.inputAnchor = new Composite(this, SWT.NONE);
gridLayout = new GridLayout(1, false);
gridLayout.horizontalSpacing = 0;
gridLayout.verticalSpacing = 0;
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
inputAnchor.setLayout(gridLayout);
inputAnchor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
this.inputAnchor.setLayout(gridLayout);
this.inputAnchor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
visibilityButton = widgetFactory.imageButton(
this.visibilityButton = widgetFactory.imageButton(
WidgetFactory.ImageIcon.VISIBILITY,
this,
PLAIN_TEXT_VIEW_TOOLTIP_KEY,
event -> changePasswordView());
GridData ld = new GridData(SWT.RIGHT, SWT.BOTTOM, false, false);
final GridData ld = new GridData(SWT.RIGHT, SWT.BOTTOM, false, false);
ld.heightHint = 22;
ld.horizontalIndent = 5;
visibilityButton.setLayoutData(ld);
this.visibilityButton.setLayoutData(ld);
changePasswordView();
@ -76,18 +78,18 @@ public class PasswordInput extends Composite {
PageService.clearComposite(this.inputAnchor);
}
Text passwordInput = new Text(
inputAnchor,
final Text passwordInput = new Text(
this.inputAnchor,
SWT.LEFT | SWT.BORDER | (buildPassword ? SWT.PASSWORD : SWT.NONE));
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
passwordInput.setLayoutData(gridData);
passwordInput.setText(value != null ? value : StringUtils.EMPTY);
if (!buildPassword) {
passwordInput.setEditable(false);
} else {
passwordInput.setEditable(isEditable);
passwordInput.setEditable(this.isEditable);
passwordInput.setData(RWT.CUSTOM_VARIANT, WidgetFactory.CustomVariant.CONFIG_INPUT_READONLY.key);
if (!isEditable) {
if (!this.isEditable) {
gridData.heightHint = 21;
}
}
@ -107,19 +109,19 @@ public class PasswordInput extends Composite {
super.layout(true, true);
}
private void changeEvent(int eventType, Event event) {
private void changeEvent(final int eventType, final Event event) {
if (!this.visibilityButton.isEnabled() && !StringUtils.endsWith(
this.passwordInput.getText(),
Constants.IMPORTED_PASSWORD_MARKER)) {
visibilityButton.setEnabled(true);
this.visibilityButton.setEnabled(true);
}
super.notifyListeners(eventType, event);
}
public void setValue(CharSequence value) {
if (passwordInput != null) {
passwordInput.setText(value != null ? value.toString() : StringUtils.EMPTY);
public void setValue(final CharSequence value) {
if (this.passwordInput != null) {
this.passwordInput.setText(value != null ? value.toString() : StringUtils.EMPTY);
if (StringUtils.endsWith(value, Constants.IMPORTED_PASSWORD_MARKER)) {
this.visibilityButton.setEnabled(false);
}
@ -127,15 +129,14 @@ public class PasswordInput extends Composite {
}
public CharSequence getValue() {
if (passwordInput != null) {
return passwordInput.getText();
if (this.passwordInput != null) {
return this.passwordInput.getText();
}
return null;
}
public void setEditable(boolean editable) {
public void setEditable(final boolean editable) {
this.isEditable = editable;
this.isPlainText = !this.isPlainText;
this.changePasswordView();

View file

@ -10,7 +10,6 @@ package ch.ethz.seb.sebserver.webservice.weblayer;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;

View file

@ -1,6 +1,6 @@
spring.application.name=SEB Server
spring.profiles.active=dev
sebserver.version=0.5.4 beta
sebserver.version=0.6.0 RC
##########################################################
### Global Server Settings