mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 10:20:41 +00:00
Code style misc. classes
This commit is contained in:
parent
081e3e188b
commit
cd5213a929
@ -13,15 +13,18 @@ import org.vaadin.artur.helpers.LaunchUtil;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* The entry point of the Spring Boot application.
|
||||
* <p>
|
||||
* 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));
|
||||
}
|
||||
|
@ -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 -> {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user