diff --git a/src/main/java/edu/kit/typicalc/Application.java b/src/main/java/edu/kit/typicalc/Application.java index e15db43..b99f1ec 100644 --- a/src/main/java/edu/kit/typicalc/Application.java +++ b/src/main/java/edu/kit/typicalc/Application.java @@ -13,15 +13,18 @@ import org.vaadin.artur.helpers.LaunchUtil; import java.util.regex.Pattern; /** - * The entry point of the Spring Boot application. - *
- * Use the * and some desktop browsers. + * Entry point of the Spring Boot application. */ @SpringBootApplication public class Application extends SpringBootServletInitializer implements AppShellConfigurator, VaadinServiceInitListener { private static final Pattern ROUTE_PATTERN = Pattern.compile("/" + TypeInferenceView.ROUTE + "/[^/]+"); + /** + * Main function executed in development mode. + * + * @param args empty array + */ public static void main(String[] args) { LaunchUtil.launchBrowserInDevelopmentMode(SpringApplication.run(Application.class, args)); } diff --git a/src/main/java/edu/kit/typicalc/TypicalcConfiguration.java b/src/main/java/edu/kit/typicalc/TypicalcConfiguration.java index 243a168..60090c4 100644 --- a/src/main/java/edu/kit/typicalc/TypicalcConfiguration.java +++ b/src/main/java/edu/kit/typicalc/TypicalcConfiguration.java @@ -8,10 +8,16 @@ import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** - * This class configures some server properties related to HTTP. + * This class configures server properties related to HTTP. */ @Configuration public class TypicalcConfiguration implements WebMvcConfigurer { + + /** + * Sets SameSite=Strict on all cookies. + * + * @return a customizer object that does the cookie modification + */ @Bean public TomcatContextCustomizer sameSiteCookiesConfig() { return context -> { diff --git a/src/main/java/edu/kit/typicalc/view/MathjaxAdapter.java b/src/main/java/edu/kit/typicalc/view/MathjaxAdapter.java index 7e28191..1751054 100644 --- a/src/main/java/edu/kit/typicalc/view/MathjaxAdapter.java +++ b/src/main/java/edu/kit/typicalc/view/MathjaxAdapter.java @@ -1,13 +1,21 @@ package edu.kit.typicalc.view; /** - * Represents an HTML element that uses MathJax and custom JavaScript classes to render its contents. - * Provides an interface between Java code and said JavaScript classes. Allows to reveal parts of the - * rendered LaTeX step-by-step. + * Represents an HTML element that uses MathJax and custom TypeScript modules to render its contents. + * Provides an interface between Java code and said TypeScript modules. + * Multiple steps can be shown using the getStepCount and showStep methods. */ public interface MathjaxAdapter { + /** + * @return amount of steps available + */ int getStepCount(); + /** + * Show a specific step to the user. + * + * @param n step index + */ void showStep(int n); } diff --git a/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java b/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java index 6a3cc2f..721656f 100644 --- a/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java +++ b/src/main/java/edu/kit/typicalc/view/TypicalcI18NProvider.java @@ -37,21 +37,17 @@ public class TypicalcI18NProvider implements I18NProvider { @Override public String getTranslation(String key, Locale locale, Object... params) { ResourceBundle bundle = ResourceBundle.getBundle(LANGUAGE_BUNDLE_PREFIX, locale); - String translation; - if (bundle.containsKey(key)) { - translation = bundle.getString(key); + return bundle.getString(key); } else { try { - translation = this.generalBundle.getString(key); + return this.generalBundle.getString(key); } catch (MissingResourceException exception) { - // this should never be the case + // this is only the case for untranslated texts return "?[" + key + "]?"; } } - - return translation; } }