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

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

Introduction

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

Prototype

IDebugBarContributor DEBUG_BAR_CONTRIB

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

Click Source Link

Usage

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//  w  w  w . j ava2s  .c  o m
                .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//from ww w  . j  a v a2 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;
            }
        });
    }
}