Search in sources :

Example 1 with IBootstrapSettings

use of de.agilecoders.wicket.core.settings.IBootstrapSettings in project hale by halestudio.

the class BasePage method configureTheme.

/**
 * sets the theme for the current user.
 *
 * @param pageParameters current page parameters
 */
private void configureTheme(PageParameters pageParameters) {
    StringValue theme = pageParameters.get("theme");
    if (!theme.isEmpty()) {
        IBootstrapSettings settings = Bootstrap.getSettings(getApplication());
        settings.getActiveThemeProvider().setActiveTheme(theme.toString(""));
    }
}
Also used : IBootstrapSettings(de.agilecoders.wicket.core.settings.IBootstrapSettings) StringValue(org.apache.wicket.util.string.StringValue)

Example 2 with IBootstrapSettings

use of de.agilecoders.wicket.core.settings.IBootstrapSettings in project webanno by webanno.

the class WicketApplicationBase method initBootstrap.

protected void initBootstrap() {
    LessCompilerConfigurationFactory lessConfigFactory = () -> {
        Configuration lessConfig = new Configuration();
        lessConfig.setCompressing(RuntimeConfigurationType.DEPLOYMENT.equals(getConfigurationType()));
        return lessConfig;
    };
    WicketWebjars.install(this);
    BootstrapLess.install(this, lessConfigFactory);
    Bootstrap.install(this);
    IBootstrapSettings settings = Bootstrap.getSettings(this);
    settings.setCssResourceReference(CustomBootstrapLessReference.get());
}
Also used : IBootstrapSettings(de.agilecoders.wicket.core.settings.IBootstrapSettings) Configuration(com.github.sommeri.less4j.LessCompiler.Configuration) LessCompilerConfigurationFactory(de.agilecoders.wicket.less.LessCompilerConfigurationFactory)

Example 3 with IBootstrapSettings

use of de.agilecoders.wicket.core.settings.IBootstrapSettings in project syncope by apache.

the class SyncopeConsoleApplication method init.

@Override
protected void init() {
    super.init();
    // read console.properties
    Properties props = PropertyUtils.read(getClass(), CONSOLE_PROPERTIES, "console.directory").getLeft();
    site = props.getProperty("site");
    Args.notNull(site, "<site>");
    anonymousUser = props.getProperty("anonymousUser");
    Args.notNull(anonymousUser, "<anonymousUser>");
    anonymousKey = props.getProperty("anonymousKey");
    Args.notNull(anonymousKey, "<anonymousKey>");
    scheme = props.getProperty("scheme");
    Args.notNull(scheme, "<scheme>");
    host = props.getProperty("host");
    Args.notNull(host, "<host>");
    port = props.getProperty("port");
    Args.notNull(port, "<port>");
    rootPath = props.getProperty("rootPath");
    Args.notNull(rootPath, "<rootPath>");
    useGZIPCompression = props.getProperty("useGZIPCompression");
    Args.notNull(useGZIPCompression, "<useGZIPCompression>");
    maxUploadFileSizeMB = props.getProperty("maxUploadFileSizeMB") == null ? null : Integer.valueOf(props.getProperty("maxUploadFileSizeMB"));
    maxWaitTime = Integer.valueOf(props.getProperty("maxWaitTimeOnApplyChanges", "30"));
    String csrf = props.getProperty("csrf");
    // process page properties
    pageClasses = new HashMap<>();
    populatePageClasses(props);
    pageClasses = Collections.unmodifiableMap(pageClasses);
    // Application settings
    IBootstrapSettings settings = new BootstrapSettings();
    // set theme provider
    settings.setThemeProvider(new SingleThemeProvider(new AdminLTE()));
    // install application settings
    Bootstrap.install(this, settings);
    getResourceSettings().setUseMinifiedResources(true);
    getResourceSettings().setThrowExceptionOnMissingResource(true);
    getJavaScriptLibrarySettings().setJQueryReference(new DynamicJQueryResourceReference());
    getSecuritySettings().setAuthorizationStrategy(new MetaDataRoleAuthorizationStrategy(this));
    ClassPathScanImplementationLookup lookup = (ClassPathScanImplementationLookup) getServletContext().getAttribute(ConsoleInitializer.CLASSPATH_LOOKUP);
    lookup.getPageClasses().forEach(cls -> MetaDataRoleAuthorizationStrategy.authorize(cls, SyncopeConsoleSession.AUTHENTICATED));
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setCompressWhitespace(true);
    if (BooleanUtils.toBoolean(csrf)) {
        getRequestCycleListeners().add(new CsrfPreventionRequestCycleListener());
    }
    getRequestCycleListeners().add(new SyncopeConsoleRequestCycleListener());
    mountPage("/login", getSignInPageClass());
    flowableModelerDirectory = props.getProperty("flowableModelerDirectory");
    Args.notNull(flowableModelerDirectory, "<flowableModelerDirectory>");
    try {
        reconciliationReportKey = props.getProperty("reconciliationReportKey");
    } catch (NumberFormatException e) {
        LOG.error("While parsing reconciliationReportKey", e);
    }
    Args.notNull(reconciliationReportKey, "<reconciliationReportKey>");
    mountResource("/" + FLOWABLE_MODELER_CONTEXT, new ResourceReference(FLOWABLE_MODELER_CONTEXT) {

        private static final long serialVersionUID = -128426276529456602L;

        @Override
        public IResource getResource() {
            return new FilesystemResource(FLOWABLE_MODELER_CONTEXT, flowableModelerDirectory);
        }
    });
    mountResource("/workflowDefGET", new ResourceReference("workflowDefGET") {

        private static final long serialVersionUID = -128426276529456602L;

        @Override
        public IResource getResource() {
            return new WorkflowDefGETResource();
        }
    });
    mountResource("/workflowDefPUT", new ResourceReference("workflowDefPUT") {

        private static final long serialVersionUID = -128426276529456602L;

        @Override
        public IResource getResource() {
            return new WorkflowDefPUTResource();
        }
    });
    // enable component path
    if (getDebugSettings().isAjaxDebugModeEnabled()) {
        getDebugSettings().setComponentPathAttributeName("syncope-path");
    }
}
Also used : SingleThemeProvider(de.agilecoders.wicket.core.settings.SingleThemeProvider) Properties(java.util.Properties) MetaDataRoleAuthorizationStrategy(org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy) IBootstrapSettings(de.agilecoders.wicket.core.settings.IBootstrapSettings) BootstrapSettings(de.agilecoders.wicket.core.settings.BootstrapSettings) CsrfPreventionRequestCycleListener(org.apache.wicket.protocol.http.CsrfPreventionRequestCycleListener) IBootstrapSettings(de.agilecoders.wicket.core.settings.IBootstrapSettings) FilesystemResource(org.apache.syncope.client.console.resources.FilesystemResource) ClassPathScanImplementationLookup(org.apache.syncope.client.console.init.ClassPathScanImplementationLookup) WorkflowDefGETResource(org.apache.syncope.client.console.resources.WorkflowDefGETResource) AdminLTE(org.apache.syncope.client.console.themes.AdminLTE) DynamicJQueryResourceReference(org.apache.wicket.resource.DynamicJQueryResourceReference) ResourceReference(org.apache.wicket.request.resource.ResourceReference) WorkflowDefPUTResource(org.apache.syncope.client.console.resources.WorkflowDefPUTResource) DynamicJQueryResourceReference(org.apache.wicket.resource.DynamicJQueryResourceReference) IResource(org.apache.wicket.request.resource.IResource)

Example 4 with IBootstrapSettings

use of de.agilecoders.wicket.core.settings.IBootstrapSettings in project estatio by estatio.

the class EstatioApplication method init.

@Override
protected void init() {
    super.init();
    IBootstrapSettings settings = Bootstrap.getSettings();
    settings.setThemeProvider(new BootswatchThemeProvider(BootswatchTheme.Sandstone));
}
Also used : IBootstrapSettings(de.agilecoders.wicket.core.settings.IBootstrapSettings) BootswatchThemeProvider(de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchThemeProvider)

Example 5 with IBootstrapSettings

use of de.agilecoders.wicket.core.settings.IBootstrapSettings in project java-design-patterns by iluwatar.

the class SimpleApplication method init.

@Override
protected void init() {
    super.init();
    IBootstrapSettings settings = Bootstrap.getSettings();
    settings.setThemeProvider(new BootswatchThemeProvider(BootswatchTheme.Flatly));
}
Also used : IBootstrapSettings(de.agilecoders.wicket.core.settings.IBootstrapSettings) BootswatchThemeProvider(de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchThemeProvider)

Aggregations

IBootstrapSettings (de.agilecoders.wicket.core.settings.IBootstrapSettings)8 BootstrapSettings (de.agilecoders.wicket.core.settings.BootstrapSettings)3 BootswatchThemeProvider (de.agilecoders.wicket.themes.markup.html.bootswatch.BootswatchThemeProvider)2 Configuration (com.github.sommeri.less4j.LessCompiler.Configuration)1 SingleThemeProvider (de.agilecoders.wicket.core.settings.SingleThemeProvider)1 LessCompilerConfigurationFactory (de.agilecoders.wicket.less.LessCompilerConfigurationFactory)1 Properties (java.util.Properties)1 ClassPathScanImplementationLookup (org.apache.syncope.client.console.init.ClassPathScanImplementationLookup)1 FilesystemResource (org.apache.syncope.client.console.resources.FilesystemResource)1 WorkflowDefGETResource (org.apache.syncope.client.console.resources.WorkflowDefGETResource)1 WorkflowDefPUTResource (org.apache.syncope.client.console.resources.WorkflowDefPUTResource)1 AdminLTE (org.apache.syncope.client.console.themes.AdminLTE)1 MetaDataRoleAuthorizationStrategy (org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy)1 JavaScriptReferenceHeaderItem (org.apache.wicket.markup.head.JavaScriptReferenceHeaderItem)1 CsrfPreventionRequestCycleListener (org.apache.wicket.protocol.http.CsrfPreventionRequestCycleListener)1 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)1 IResource (org.apache.wicket.request.resource.IResource)1 ResourceReference (org.apache.wicket.request.resource.ResourceReference)1 DynamicJQueryResourceReference (org.apache.wicket.resource.DynamicJQueryResourceReference)1 StringValue (org.apache.wicket.util.string.StringValue)1