Java Code Examples for org.apache.wicket.RuntimeConfigurationType#DEVELOPMENT

The following examples show how to use org.apache.wicket.RuntimeConfigurationType#DEVELOPMENT . 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: Application.java    From openmeetings with Apache License 2.0 6 votes vote down vote up
public static String getString(String key, final Locale loc, String... _params) {
	if (!exists()) {
		ThreadContext.setApplication(org.apache.wicket.Application.get(appName));
	}
	String[] params = _params;
	if ((params == null || params.length == 0) && STRINGS_WITH_APP.contains(key)) {
		params = new String[]{getApplicationName()};
	}
	Localizer l = get().getResourceSettings().getLocalizer();
	String value = l.getStringIgnoreSettings(key, null, null, loc, null, "[Missing]");
	if (params != null && params.length > 0) {
		final MessageFormat format = new MessageFormat(value, loc);
		value = format.format(params);
	}
	if (RuntimeConfigurationType.DEVELOPMENT == get().getConfigurationType()) {
		value += String.format(" [%s]", key);
	}
	return value;
}
 
Example 2
Source File: OneWebApplication.java    From onedev with MIT License 5 votes vote down vote up
@Override
public RuntimeConfigurationType getConfigurationType() {
	if (Bootstrap.sandboxMode && !Bootstrap.prodMode)
		return RuntimeConfigurationType.DEVELOPMENT;
	else
		return RuntimeConfigurationType.DEPLOYMENT;
}
 
Example 3
Source File: AbstractWebPage.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
private void determineStatefulComponentOnDev() {

        if (Application.get().getConfigurationType() == RuntimeConfigurationType.DEVELOPMENT && !isPageStateless()) {

            final List<String> statefulComponentIds = new ArrayList<>();
            this.visitChildren(Component.class, (object, objectIVisit) -> {
                if (!object.isStateless()) {
                    statefulComponentIds.add(object.getId());
                }
            });
            LOG.warn("[DEV] Page {} is stateful because of the following components: {}", getClass().getCanonicalName(), statefulComponentIds);

        }
    }
 
Example 4
Source File: HTMLValidatorConfig.java    From wicket-spring-boot with Apache License 2.0 5 votes vote down vote up
@Override
public void init(WebApplication webApplication) {
	if (RuntimeConfigurationType.DEVELOPMENT == webApplication.getConfigurationType()) {
		webApplication.getMarkupSettings().setStripWicketTags(true);
		webApplication.getRequestCycleSettings().addResponseFilter(new HtmlValidationResponseFilter());
	}
}
 
Example 5
Source File: WicketApplication.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Own solution: uses development parameter of servlet context init parameter (see context.xml or server.xml).
 * @return DEVELOPMENT, if development variable of servlet context is set to "true" otherwise DEPLOYMENT.
 * @see org.apache.wicket.protocol.http.WebApplication#getConfigurationType()
 */
@Override
public RuntimeConfigurationType getConfigurationType()
{
  if (isDevelopmentSystem() == true) {
    return RuntimeConfigurationType.DEVELOPMENT;
  }
  return RuntimeConfigurationType.DEPLOYMENT;
}
 
Example 6
Source File: EtcdViewerApplication.java    From etcd-viewer with Apache License 2.0 3 votes vote down vote up
/**
 * @see org.apache.wicket.Application#init()
 */
@Override
public void init()
{
    super.init();

    getComponentInstantiationListeners().add(new GuiceComponentInjector(this, new RestModule()));

    if (getConfigurationType() == RuntimeConfigurationType.DEVELOPMENT) {

        getResourceSettings().setUseMinifiedResources(false);
        getDebugSettings().setDevelopmentUtilitiesEnabled(true);

    } else {

        getResourceSettings().setUseMinifiedResources(true);
        getDebugSettings().setDevelopmentUtilitiesEnabled(false);

    }

    getMarkupSettings().setStripWicketTags(true);

    mountPage("/home", HomePage.class);
    mountPage("/etcd/#{cluster}", NavigationPage.class);
    mountPage("/registries", RegistriesPage.class);

    mountPage("/about", AboutPage.class);

    mountPage("/signin", AuthPage.class);

    // add your configuration here
}