Example usage for org.apache.wicket.devutils.debugbar InspectorDebugPanel DEBUG_BAR_CONTRIB

List of usage examples for org.apache.wicket.devutils.debugbar InspectorDebugPanel DEBUG_BAR_CONTRIB

Introduction

In this page you can find the example usage for org.apache.wicket.devutils.debugbar InspectorDebugPanel DEBUG_BAR_CONTRIB.

Prototype

IDebugBarContributor DEBUG_BAR_CONTRIB

To view the source code for org.apache.wicket.devutils.debugbar InspectorDebugPanel DEBUG_BAR_CONTRIB.

Click Source Link

Usage

From source file:org.devgateway.eudevfin.ui.common.spring.WicketSpringApplication.java

License:Open Source License

@Override
protected void init() {
    super.init();

    configureBootstrap();/*from w  w w . j  a v  a  2s  .c  om*/
    configureResourceBundles();

    //http://stackoverflow.com/questions/15996913/wicket-avoid-302-redirect-to-homepage
    //getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER);

    setHeaderResponseDecorator(new RenderJavaScriptToFooterHeaderResponseDecorator());

    //mount annotated pages
    new AnnotatedMountScanner().scanPackage("org.devgateway.eudevfin").mount(this);

    //implemented ApplicationContextAware and added context as a parameter to help JUnit tests work
    getComponentInstantiationListeners().add(new SpringComponentInjector(this, springContext, true));

    if (getSecuritySettings().getAuthorizationStrategy() instanceof CompoundAuthorizationStrategy) {
        CompoundAuthorizationStrategy cas = (CompoundAuthorizationStrategy) getSecuritySettings()
                .getAuthorizationStrategy();
        cas.add(new PermissionAuthorizationStrategy());
    }

    getResourceSettings().setUseMinifiedResources(false); //prevents bug in wicket-bootstrap that's trying to minify a png       

    getApplicationSettings().setDefaultMaximumUploadSize(Bytes.megabytes(5));//set maximum file size for upload form

    //DEPLOYMENT MODE?
    if (RuntimeConfigurationType.DEPLOYMENT.equals(this.getConfigurationType())) {
        //compress resources
        getResourceSettings().setJavaScriptCompressor(
                new GoogleClosureJavaScriptCompressor(CompilationLevel.SIMPLE_OPTIMIZATIONS));
        getResourceSettings().setCssCompressor(new YuiCssCompressor());
    } else {
        //see https://issues.apache.org/jira/browse/WICKET-5388
        //we do not use SessionSizeDebugPanel
        List<IDebugBarContributor> debugContributors = new ArrayList<>();
        debugContributors.add(VersionDebugContributor.DEBUG_BAR_CONTRIB);
        debugContributors.add(InspectorDebugPanel.DEBUG_BAR_CONTRIB);
        debugContributors.add(SessionSizeDebugPanel.DEBUG_BAR_CONTRIB);
        DebugBar.setContributors(debugContributors, this);
    }

    //set response for session timeout:
    getApplicationSettings().setPageExpiredErrorPage(LoginPage.class);

    //add the navbar 
    //        Navbar navbar = new Navbar("navbar");
    //        navbar.setPosition(Navbar.Position.TOP);
    //        // show brand name
    //        navbar.brandName(Model.of("EU-DEVFIN"));
    //        //register the navbar as a spring bean
    //        springContext.getAutowireCapableBeanFactory().initializeBean(navbar, "wicketNavbar");

}

From source file:org.efaps.esjp.ui.dev.DevUtils.java

License:Apache License

public Return toggleDevUtils(final Parameter _parameter) throws EFapsException {
    //Administration
    if (Role.get(UUID.fromString("1d89358d-165a-4689-8c78-fc625d37aacd")).isAssigned()) {
        final WebApplication application = WebApplication.get();
        DevUtils.LOG//from  w  w w . j a  v a  2  s .com
                .info("Toggle devutils: " + !application.getDebugSettings().isDevelopmentUtilitiesEnabled());
        application.getDebugSettings().setDevelopmentUtilitiesEnabled(
                !application.getDebugSettings().isDevelopmentUtilitiesEnabled());

        // check to add them only once
        if (application.getMetaData(DevUtils.DEBUG_BAR_CONTRIBUTED) == null) {
            DebugBar.registerContributor(VersionDebugContributor.DEBUG_BAR_CONTRIB, application);
            DebugBar.registerContributor(InspectorDebugPanel.DEBUG_BAR_CONTRIB, application);
            DebugBar.registerContributor(SessionSizeDebugPanel.DEBUG_BAR_CONTRIB, application);
            DebugBar.registerContributor(PageSizeDebugPanel.DEBUG_BAR_CONTRIB, application);
            application.setMetaData(DevUtils.DEBUG_BAR_CONTRIBUTED, true);
        }
    }
    return new Return();
}

From source file:org.sakaiproject.sitestats.tool.wicket.SiteStatsApplication.java

License:Educational Community License

@Override
protected void init() {
    super.init();

    // Configure general wicket application settings
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
    getResourceSettings().setThrowExceptionOnMissingResource(false);
    getMarkupSettings().setStripWicketTags(true);
    getResourceSettings().getStringResourceLoaders().add(new SiteStatsStringResourceLoader());
    getResourceSettings().getResourceFinders().add(new WebApplicationPath(getServletContext(), "html"));
    getResourceSettings().setResourceStreamLocator(new SiteStatsResourceStreamLocator());
    getDebugSettings().setAjaxDebugModeEnabled(debug);

    // Home page/* w ww . j  av  a  2  s  .  c o  m*/
    mountPage("/home", OverviewPage.class);

    // On wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(OverviewPage.class);
    getApplicationSettings().setAccessDeniedPage(OverviewPage.class);

    // Debugging
    debug = ServerConfigurationService.getBoolean("sitestats.debug", false);
    if (debug) {
        getDebugSettings().setComponentUseCheck(true);
        getDebugSettings().setAjaxDebugModeEnabled(true);
        getDebugSettings().setLinePreciseReportingOnAddComponentEnabled(true);
        getDebugSettings().setLinePreciseReportingOnNewComponentEnabled(true);
        getDebugSettings().setOutputComponentPath(true);
        getDebugSettings().setOutputMarkupContainerClassName(true);
        getDebugSettings().setDevelopmentUtilitiesEnabled(true);
        getMarkupSettings().setStripWicketTags(false);
        getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_EXCEPTION_PAGE);
        // register standard debug contributors so that just setting the sitestats.debug property is enough to turn these on
        // otherwise, you have to turn wicket development mode on to get this populated due to the order methods are called
        DebugBar.registerContributor(VersionDebugContributor.DEBUG_BAR_CONTRIB, this);
        DebugBar.registerContributor(InspectorDebugPanel.DEBUG_BAR_CONTRIB, this);
        DebugBar.registerContributor(SessionSizeDebugPanel.DEBUG_BAR_CONTRIB, this);
        DebugBar.registerContributor(PageSizeDebugPanel.DEBUG_BAR_CONTRIB, this);
    } else {
        // Throw RuntimeDeceptions so they are caught by the Sakai ErrorReportHandler
        getRequestCycleListeners().add(new AbstractRequestCycleListener() {
            @Override
            public IRequestHandler onException(RequestCycle cycle, Exception ex) {
                if (ex instanceof RuntimeException) {
                    throw (RuntimeException) ex;
                }
                return null;
            }
        });
    }
}