Code style misc. classes

This commit is contained in:
Arne Keller 2021-03-08 20:38:26 +01:00
parent 081e3e188b
commit cd5213a929
4 changed files with 27 additions and 14 deletions

View File

@ -13,15 +13,18 @@ import org.vaadin.artur.helpers.LaunchUtil;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
* The entry point of the Spring Boot application. * Entry point of the Spring Boot application.
* <p>
* Use the * and some desktop browsers.
*/ */
@SpringBootApplication @SpringBootApplication
public class Application extends SpringBootServletInitializer public class Application extends SpringBootServletInitializer
implements AppShellConfigurator, VaadinServiceInitListener { implements AppShellConfigurator, VaadinServiceInitListener {
private static final Pattern ROUTE_PATTERN = Pattern.compile("/" + TypeInferenceView.ROUTE + "/[^/]+"); 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) { public static void main(String[] args) {
LaunchUtil.launchBrowserInDevelopmentMode(SpringApplication.run(Application.class, args)); LaunchUtil.launchBrowserInDevelopmentMode(SpringApplication.run(Application.class, args));
} }

View File

@ -8,10 +8,16 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 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 @Configuration
public class TypicalcConfiguration implements WebMvcConfigurer { public class TypicalcConfiguration implements WebMvcConfigurer {
/**
* Sets SameSite=Strict on all cookies.
*
* @return a customizer object that does the cookie modification
*/
@Bean @Bean
public TomcatContextCustomizer sameSiteCookiesConfig() { public TomcatContextCustomizer sameSiteCookiesConfig() {
return context -> { return context -> {

View File

@ -1,13 +1,21 @@
package edu.kit.typicalc.view; package edu.kit.typicalc.view;
/** /**
* Represents an HTML element that uses MathJax and custom JavaScript classes to render its contents. * Represents an HTML element that uses MathJax and custom TypeScript modules to render its contents.
* Provides an interface between Java code and said JavaScript classes. Allows to reveal parts of the * Provides an interface between Java code and said TypeScript modules.
* rendered LaTeX step-by-step. * Multiple steps can be shown using the getStepCount and showStep methods.
*/ */
public interface MathjaxAdapter { public interface MathjaxAdapter {
/**
* @return amount of steps available
*/
int getStepCount(); int getStepCount();
/**
* Show a specific step to the user.
*
* @param n step index
*/
void showStep(int n); void showStep(int n);
} }

View File

@ -37,21 +37,17 @@ public class TypicalcI18NProvider implements I18NProvider {
@Override @Override
public String getTranslation(String key, Locale locale, Object... params) { public String getTranslation(String key, Locale locale, Object... params) {
ResourceBundle bundle = ResourceBundle.getBundle(LANGUAGE_BUNDLE_PREFIX, locale); ResourceBundle bundle = ResourceBundle.getBundle(LANGUAGE_BUNDLE_PREFIX, locale);
String translation;
if (bundle.containsKey(key)) { if (bundle.containsKey(key)) {
translation = bundle.getString(key); return bundle.getString(key);
} else { } else {
try { try {
translation = this.generalBundle.getString(key); return this.generalBundle.getString(key);
} catch (MissingResourceException exception) { } catch (MissingResourceException exception) {
// this should never be the case // this is only the case for untranslated texts
return "?[" + key + "]?"; return "?[" + key + "]?";
} }
} }
return translation;
} }
} }