From ae26c1134f16a8612b5dde13f126641b8ed0160a Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 11 Mar 2020 14:23:12 +0100 Subject: [PATCH] code cleanup --- pom.xml | 5 ----- .../gui/content/ConfigTemplateAttributeForm.java | 4 +--- .../seb/sebserver/gui/content/LmsSetupForm.java | 15 ++++----------- .../gui/content/MonitoringClientConnection.java | 4 +--- .../sebserver/gui/content/UserActivityLogs.java | 5 +---- .../gui/content/action/ActionDefinition.java | 2 +- 6 files changed, 8 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 9f5f47f6..67ee7656 100644 --- a/pom.xml +++ b/pom.xml @@ -151,11 +151,6 @@ - - - - - diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/ConfigTemplateAttributeForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/ConfigTemplateAttributeForm.java index 99f4511c..1e3ecc45 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/ConfigTemplateAttributeForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/ConfigTemplateAttributeForm.java @@ -10,7 +10,6 @@ package ch.ethz.seb.sebserver.gui.content; import java.util.Collections; -import org.apache.commons.lang3.StringUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -50,7 +49,6 @@ import ch.ethz.seb.sebserver.gui.service.remote.webservice.api.seb.examconfig.Ge import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.CurrentUser; import ch.ethz.seb.sebserver.gui.service.remote.webservice.auth.CurrentUser.EntityGrantCheck; import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; -import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant; @Lazy @Component @@ -170,7 +168,7 @@ public class ConfigTemplateAttributeForm implements TemplateComposer { widgetFactory.addFormSubContextHeader( valSpace, FORM_VALUE_TEXT_KEY, - FORM_VALUE_TOOLTIP_TEXT_KEY ); + FORM_VALUE_TOOLTIP_TEXT_KEY); final Composite grid = new Composite(valSpace, SWT.NONE); grid.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java index a7f987c1..9845561d 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/LmsSetupForm.java @@ -14,7 +14,6 @@ import java.util.Set; import java.util.function.BooleanSupplier; import java.util.function.Function; -import ch.ethz.seb.sebserver.gbl.model.sebconfig.SebClientConfig; import org.apache.commons.lang3.StringUtils; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Button; @@ -83,8 +82,6 @@ public class LmsSetupForm implements TemplateComposer { new LocTextKey("sebserver.lmssetup.form.name"); private static final LocTextKey FORM_INSTITUTION_TEXT_KEY = new LocTextKey("sebserver.lmssetup.form.institution"); - private static final LocTextKey FORM_PROXY_KEY = - new LocTextKey("sebserver.lmssetup.form.proxy"); private static final LocTextKey FORM_PROXY_CHECK_KEY = new LocTextKey("sebserver.lmssetup.form.proxy.check"); private static final LocTextKey FORM_PROXY_HOST_KEY = @@ -102,8 +99,7 @@ public class LmsSetupForm implements TemplateComposer { Domain.LMS_SETUP.ATTR_LMS_PROXY_HOST, Domain.LMS_SETUP.ATTR_LMS_PROXY_PORT, Domain.LMS_SETUP.ATTR_LMS_PROXY_AUTH_USERNAME, - Domain.LMS_SETUP.ATTR_LMS_PROXY_AUTH_SECRET - )); + Domain.LMS_SETUP.ATTR_LMS_PROXY_AUTH_SECRET)); private final PageService pageService; private final ResourceService resourceService; @@ -227,7 +223,6 @@ public class LmsSetupForm implements TemplateComposer { .asPasswordField() .mandatory(!readonly)) - .addFieldIf( isEdit, () -> FormBuilder.checkbox( @@ -286,20 +281,18 @@ public class LmsSetupForm implements TemplateComposer { if (!readonly) { formHandle.process( PROXY_ATTRIBUTES::contains, - ffa -> ffa.setVisible(withProxy) - ); + ffa -> ffa.setVisible(withProxy)); formHandle.getForm().getFieldInput("FORM_PROXY_CHECK") .addListener(SWT.Selection, event -> formHandle.process( PROXY_ATTRIBUTES::contains, ffa -> { - boolean selected = ((Button) event.widget).getSelection(); + final boolean selected = ((Button) event.widget).getSelection(); ffa.setVisible(selected); if (!selected) { ffa.resetError(); ffa.setStringValue(""); } - } - )); + })); } // propagate content actions to action-pane diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringClientConnection.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringClientConnection.java index 56d1e149..3ca8a2a3 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringClientConnection.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/MonitoringClientConnection.java @@ -51,7 +51,6 @@ import ch.ethz.seb.sebserver.gui.table.ColumnDefinition; import ch.ethz.seb.sebserver.gui.table.ColumnDefinition.TableFilterAttribute; import ch.ethz.seb.sebserver.gui.table.TableFilter.CriteriaType; import ch.ethz.seb.sebserver.gui.widget.WidgetFactory; -import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.CustomVariant; @Lazy @Component @@ -172,8 +171,7 @@ public class MonitoringClientConnection implements TemplateComposer { widgetFactory.addFormSubContextHeader( content, EVENT_LIST_TITLE_KEY, - EVENT_LIST_TITLE_TOOLTIP_KEY - ); + EVENT_LIST_TITLE_TOOLTIP_KEY); final PageService.PageActionBuilder actionBuilder = this.pageService .pageActionBuilder( diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserActivityLogs.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserActivityLogs.java index 0b210859..99986a28 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserActivityLogs.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserActivityLogs.java @@ -74,8 +74,6 @@ public class UserActivityLogs implements TemplateComposer { new LocTextKey("sebserver.userlogs.form.user"); private static final LocTextKey FORM_DATE_TEXT_KEY = new LocTextKey("sebserver.userlogs.form.dateTime"); - private static final LocTextKey FORM_DETAILS_DATE_TEXT_KEY = - new LocTextKey("sebserver.userlogs.form.dateTime"); private static final LocTextKey FORM_ACTIVITY_TEXT_KEY = new LocTextKey("sebserver.userlogs.form.activityType"); private static final LocTextKey FORM_ENTITY_TYPE_TEXT_KEY = @@ -85,7 +83,6 @@ public class UserActivityLogs implements TemplateComposer { private static final LocTextKey FORM_MESSAGE_TEXT_KEY = new LocTextKey("sebserver.userlogs.form.message"); - private final TableFilterAttribute institutionFilter; private final TableFilterAttribute userNameFilter = new TableFilterAttribute(CriteriaType.TEXT, UserActivityLog.FILTER_ATTR_USER_NAME); @@ -274,7 +271,7 @@ public class UserActivityLogs implements TemplateComposer { userActivityLog.entityId)) .addField(FormBuilder.text( Domain.USER_ACTIVITY_LOG.ATTR_TIMESTAMP, - FORM_DETAILS_DATE_TEXT_KEY, + FORM_DATE_TEXT_KEY, this.widgetFactory.getI18nSupport() .formatDisplayDateTime(Utils.toDateTimeUTC(userActivityLog.timestamp)) + " " + this.i18nSupport.getUsersTimeZoneTitleSuffix())) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/action/ActionDefinition.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/action/ActionDefinition.java index 65ec43f8..bb34c320 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/action/ActionDefinition.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/action/ActionDefinition.java @@ -84,7 +84,7 @@ public enum ActionDefinition { new LocTextKey("sebserver.useraccount.action.new"), ImageIcon.USER, PageStateDefinitionImpl.USER_ACCOUNT_EDIT, - ActionCategory.FORM.LIST_VARIA), + ActionCategory.LIST_VARIA), USER_ACCOUNT_VIEW_FROM_LIST( new LocTextKey("sebserver.useraccount.action.view"), ImageIcon.SHOW,