org.springframework.ui.context.ThemeSource Java Examples

The following examples show how to use org.springframework.ui.context.ThemeSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourceBundleThemeSource.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public void setParentThemeSource(@Nullable ThemeSource parent) {
	this.parentThemeSource = parent;

	// Update existing Theme objects.
	// Usually there shouldn't be any at the time of this call.
	synchronized (this.themeCache) {
		for (Theme theme : this.themeCache.values()) {
			initParent(theme);
		}
	}
}
 
Example #2
Source File: DispatcherServlet.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return this servlet's ThemeSource, if any; else return {@code null}.
 * <p>Default is to return the WebApplicationContext as ThemeSource,
 * provided that it implements the ThemeSource interface.
 * @return the ThemeSource, if any
 * @see #getWebApplicationContext()
 */
public final ThemeSource getThemeSource() {
	if (getWebApplicationContext() instanceof ThemeSource) {
		return (ThemeSource) getWebApplicationContext();
	}
	else {
		return null;
	}
}
 
Example #3
Source File: RequestContextUtils.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Retrieves the current theme from the given request, using the ThemeResolver
 * and ThemeSource bound to the request by the DispatcherServlet.
 * @param request current HTTP request
 * @return the current theme, or {@code null} if not found
 * @see #getThemeResolver
 */
public static Theme getTheme(HttpServletRequest request) {
	ThemeResolver themeResolver = getThemeResolver(request);
	ThemeSource themeSource = getThemeSource(request);
	if (themeResolver != null && themeSource != null) {
		String themeName = themeResolver.resolveThemeName(request);
		return themeSource.getTheme(themeName);
	}
	else {
		return null;
	}
}
 
Example #4
Source File: ResourceBundleThemeSource.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void setParentThemeSource(ThemeSource parent) {
	this.parentThemeSource = parent;

	// Update existing Theme objects.
	// Usually there shouldn't be any at the time of this call.
	synchronized (this.themeCache) {
		for (Theme theme : this.themeCache.values()) {
			initParent(theme);
		}
	}
}
 
Example #5
Source File: RequestContextUtils.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Retrieves the current theme from the given request, using the ThemeResolver
 * and ThemeSource bound to the request by the DispatcherServlet.
 * @param request current HTTP request
 * @return the current theme, or {@code null} if not found
 * @see #getThemeResolver
 */
@Nullable
public static Theme getTheme(HttpServletRequest request) {
	ThemeResolver themeResolver = getThemeResolver(request);
	ThemeSource themeSource = getThemeSource(request);
	if (themeResolver != null && themeSource != null) {
		String themeName = themeResolver.resolveThemeName(request);
		return themeSource.getTheme(themeName);
	}
	else {
		return null;
	}
}
 
Example #6
Source File: ResourceBundleThemeSource.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public void setParentThemeSource(ThemeSource parent) {
	this.parentThemeSource = parent;

	// Update existing Theme objects.
	// Usually there shouldn't be any at the time of this call.
	synchronized (this.themeCache) {
		for (Theme theme : this.themeCache.values()) {
			initParent(theme);
		}
	}
}
 
Example #7
Source File: ResourceBundleThemeSource.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public void setParentThemeSource(@Nullable ThemeSource parent) {
	this.parentThemeSource = parent;

	// Update existing Theme objects.
	// Usually there shouldn't be any at the time of this call.
	synchronized (this.themeCache) {
		for (Theme theme : this.themeCache.values()) {
			initParent(theme);
		}
	}
}
 
Example #8
Source File: RequestContextUtils.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Retrieves the current theme from the given request, using the ThemeResolver
 * and ThemeSource bound to the request by the DispatcherServlet.
 * @param request current HTTP request
 * @return the current theme, or {@code null} if not found
 * @see #getThemeResolver
 */
@Nullable
public static Theme getTheme(HttpServletRequest request) {
	ThemeResolver themeResolver = getThemeResolver(request);
	ThemeSource themeSource = getThemeSource(request);
	if (themeResolver != null && themeSource != null) {
		String themeName = themeResolver.resolveThemeName(request);
		return themeSource.getTheme(themeName);
	}
	else {
		return null;
	}
}
 
Example #9
Source File: RequestContextUtils.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Retrieves the current theme from the given request, using the ThemeResolver
 * and ThemeSource bound to the request by the DispatcherServlet.
 * @param request current HTTP request
 * @return the current theme, or {@code null} if not found
 * @see #getThemeResolver
 */
public static Theme getTheme(HttpServletRequest request) {
	ThemeResolver themeResolver = getThemeResolver(request);
	ThemeSource themeSource = getThemeSource(request);
	if (themeResolver != null && themeSource != null) {
		String themeName = themeResolver.resolveThemeName(request);
		return themeSource.getTheme(themeName);
	}
	else {
		return null;
	}
}
 
Example #10
Source File: DispatcherServlet.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Return this servlet's ThemeSource, if any; else return {@code null}.
 * <p>Default is to return the WebApplicationContext as ThemeSource,
 * provided that it implements the ThemeSource interface.
 * @return the ThemeSource, if any
 * @see #getWebApplicationContext()
 */
public final ThemeSource getThemeSource() {
	if (getWebApplicationContext() instanceof ThemeSource) {
		return (ThemeSource) getWebApplicationContext();
	}
	else {
		return null;
	}
}
 
Example #11
Source File: DelegatingThemeSource.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public void setParentThemeSource(ThemeSource parentThemeSource) {
	this.parentThemeSource = parentThemeSource;
}
 
Example #12
Source File: ResourceBundleThemeSource.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public ThemeSource getParentThemeSource() {
	return this.parentThemeSource;
}
 
Example #13
Source File: DelegatingThemeSource.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ThemeSource getParentThemeSource() {
	return parentThemeSource;
}
 
Example #14
Source File: DelegatingThemeSource.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setParentThemeSource(ThemeSource parentThemeSource) {
	this.parentThemeSource = parentThemeSource;
}
 
Example #15
Source File: DelegatingThemeSource.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public ThemeSource getParentThemeSource() {
	return parentThemeSource;
}
 
Example #16
Source File: ResourceBundleThemeSource.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ThemeSource getParentThemeSource() {
	return this.parentThemeSource;
}
 
Example #17
Source File: ResourceBundleThemeSource.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Nullable
public ThemeSource getParentThemeSource() {
	return this.parentThemeSource;
}
 
Example #18
Source File: DelegatingThemeSource.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Nullable
public ThemeSource getParentThemeSource() {
	return this.parentThemeSource;
}
 
Example #19
Source File: DelegatingThemeSource.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public void setParentThemeSource(@Nullable ThemeSource parentThemeSource) {
	this.parentThemeSource = parentThemeSource;
}
 
Example #20
Source File: ResourceBundleThemeSource.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Nullable
public ThemeSource getParentThemeSource() {
	return this.parentThemeSource;
}
 
Example #21
Source File: DelegatingThemeSource.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Nullable
public ThemeSource getParentThemeSource() {
	return this.parentThemeSource;
}
 
Example #22
Source File: DelegatingThemeSource.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public void setParentThemeSource(@Nullable ThemeSource parentThemeSource) {
	this.parentThemeSource = parentThemeSource;
}
 
Example #23
Source File: RequestContextUtils.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the ThemeSource that has been bound to the request by the
 * DispatcherServlet.
 * @param request current HTTP request
 * @return the current ThemeSource
 */
public static ThemeSource getThemeSource(HttpServletRequest request) {
	return (ThemeSource) request.getAttribute(DispatcherServlet.THEME_SOURCE_ATTRIBUTE);
}
 
Example #24
Source File: DispatcherServlet.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Return this servlet's ThemeSource, if any; else return {@code null}.
 * <p>Default is to return the WebApplicationContext as ThemeSource,
 * provided that it implements the ThemeSource interface.
 * @return the ThemeSource, if any
 * @see #getWebApplicationContext()
 */
@Nullable
public final ThemeSource getThemeSource() {
	return (getWebApplicationContext() instanceof ThemeSource ? (ThemeSource) getWebApplicationContext() : null);
}
 
Example #25
Source File: RequestContextUtils.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Return the ThemeSource that has been bound to the request by the
 * DispatcherServlet.
 * @param request current HTTP request
 * @return the current ThemeSource
 */
@Nullable
public static ThemeSource getThemeSource(HttpServletRequest request) {
	return (ThemeSource) request.getAttribute(DispatcherServlet.THEME_SOURCE_ATTRIBUTE);
}
 
Example #26
Source File: DispatcherServlet.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Return this servlet's ThemeSource, if any; else return {@code null}.
 * <p>Default is to return the WebApplicationContext as ThemeSource,
 * provided that it implements the ThemeSource interface.
 * @return the ThemeSource, if any
 * @see #getWebApplicationContext()
 */
@Nullable
public final ThemeSource getThemeSource() {
	return (getWebApplicationContext() instanceof ThemeSource ? (ThemeSource) getWebApplicationContext() : null);
}
 
Example #27
Source File: RequestContextUtils.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Return the ThemeSource that has been bound to the request by the
 * DispatcherServlet.
 * @param request current HTTP request
 * @return the current ThemeSource
 */
@Nullable
public static ThemeSource getThemeSource(HttpServletRequest request) {
	return (ThemeSource) request.getAttribute(DispatcherServlet.THEME_SOURCE_ATTRIBUTE);
}
 
Example #28
Source File: RequestContextUtils.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Return the ThemeSource that has been bound to the request by the
 * DispatcherServlet.
 * @param request current HTTP request
 * @return the current ThemeSource
 */
public static ThemeSource getThemeSource(HttpServletRequest request) {
	return (ThemeSource) request.getAttribute(DispatcherServlet.THEME_SOURCE_ATTRIBUTE);
}