org.apache.wicket.devutils.debugbar.DebugBar Java Examples

The following examples show how to use org.apache.wicket.devutils.debugbar.DebugBar. 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: BasePage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public BasePage(){
	// Set Sakai Locale
	ResourceLoader rl = new ResourceLoader();
	getSession().setLocale(rl.getLocale());

       TransparentWebMarkupContainer html = new TransparentWebMarkupContainer("html");

       String locale = getSession().getLocale().toString();
       html.add(AttributeModifier.replace("lang", locale));
       html.add(AttributeModifier.replace("xml:lang", locale));

       add(html);
	
	add(new DebugBar("debug"));
	add(new HeaderResponseContainer("bottom-script-container", "bottom-script-container"));
}
 
Example #2
Source File: HomePage.java    From wicket-orientdb with Apache License 2.0 6 votes vote down vote up
public HomePage(final PageParameters parameters) {
		super(parameters);

		add(new DebugBar("debugBar"));
		add(new Label("dbName", new PropertyModel<String>(this, "session.database.name")));
		add(new Label("dbUrl", new PropertyModel<String>(this, "session.database.URL")));
		add(new Label("dbUserName", new PropertyModel<String>(this, "session.database.user.name")));
		add(new Label("signedIn", new PropertyModel<String>(this, "session.signedIn")));
		add(new Label("signedInUser", new PropertyModel<String>(this, "session.user.name")));
//		((OrientDbWebSession)getSession()).getDatabase().getUser().
		add(new SignInPanel("signInPanel"));
		OQueryDataProvider<ODocument> provider = new OQueryDataProvider<>("select from "+WicketApplication.CLASS_NAME);
		List<IColumn<ODocument, String>> columns = new ArrayList<>();
		columns.add(new DocumentPropertyColumn(Model.of(WicketApplication.PROP_NAME), WicketApplication.PROP_NAME, WicketApplication.PROP_NAME));
		columns.add(new DocumentPropertyColumn(Model.of(WicketApplication.PROP_INT), WicketApplication.PROP_INT, WicketApplication.PROP_INT));
		columns.add(new DocumentPropertyColumn(Model.of(WicketApplication.PROP_DATE), WicketApplication.PROP_DATE, WicketApplication.PROP_DATE));
		DefaultDataTable<ODocument, String> table = new DefaultDataTable<>("table", columns, provider, 15);
		add(table);
    }
 
Example #3
Source File: BasePage.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public BasePage(){
	// Set Sakai Locale
	ResourceLoader rl = new ResourceLoader();
	getSession().setLocale(rl.getLocale());

       TransparentWebMarkupContainer html = new TransparentWebMarkupContainer("html");

       String locale = getSession().getLocale().toString();
       html.add(AttributeModifier.replace("lang", locale));
       html.add(AttributeModifier.replace("xml:lang", locale));

       add(html);
	
	add(new DebugBar("debug"));
	add(new HeaderResponseContainer("bottom-script-container", "bottom-script-container"));
}
 
Example #4
Source File: Module.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@Override
public void onInitialize(OrienteerWebApplication app, ODatabaseDocument db) {
	super.onInitialize(app, db);
	app.mountPackage("org.orienteer.devutils.web");
	WicketConsolePage.setWicketConsolePageImplementation(ToolsPage.class);
	app.mountPackage("/devutils", LiveSessionsPage.class);
	app.mountPage("/wicket-console", WicketConsolePage.class);
	app.registerWidgets("org.orienteer.devutils.component.widget");
	app.getComponentInitializationListeners().add(this);
	if(!app.getDebugSettings().isDevelopmentUtilitiesEnabled())
	{
		app.getDebugSettings().setDevelopmentUtilitiesEnabled(true);
		List<IDebugBarContributor> contributors = new ArrayList<IDebugBarContributor>(DebugBar.getContributors(app));
		CONTRIBUTORS.forEach((c) -> {if(!contributors.contains(c)) contributors.add(c);});
		DebugBar.setContributors(contributors, app);
	}
}
 
Example #5
Source File: Module.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
@Override
public void onInitialize(Component component) {
	if(component instanceof BasePage && isAllowed(FEATURE_RESOURCE, "devutils", OrientPermission.CREATE,
																				OrientPermission.READ,
																				OrientPermission.UPDATE,
																				OrientPermission.DELETE)) {
		BasePage<?> page = (BasePage<?>)component;
		DebugBar debugBar = new DebugBar(page.nextUiPluginComponentId());
		debugBar.add(new AttributeAppender("style", "position: fixed; "
												  + "left: 0; "
												  + "bottom: 0; "
												  + "top: inherit; "
												  + "z-index: 99999", 
												  "; "));
		page.addUiPlugin(debugBar);
	}
}
 
Example #6
Source File: TemplatePage.java    From etcd-viewer with Apache License 2.0 5 votes vote down vote up
private void createPage() {

        add(title = new Label("title", new LoadableDetachableModel<Object>() {
            private static final long serialVersionUID = 1L;
            @Override
            protected Object load() {
                return getPageTitleModel().getObject();
            }
        }));

        title.setOutputMarkupId(true);

        if (getApplication().getDebugSettings().isDevelopmentUtilitiesEnabled()) {
            add(new DebugBar("debug"));
        } else {
            add(new EmptyPanel("debug").setVisible(false));
        }

        add(createMenuItem("homeMenuItem", "home", HomePage.class));
        add(createMenuItem("aboutMenuItem", "about", AboutPage.class));

        add(selectRegistryPanel = new SelectRegistryPanel("selectRegistry"));
        selectRegistryPanel.setOutputMarkupId(true);

        add(new SignInPanel("authPanel"));
        add(new SignOutPanel("signOut"));
    }
 
Example #7
Source File: SiteStatsApplication.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@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);

	// configure bottom page script loading
	setHeaderResponseDecorator(new JavaScriptToBucketResponseDecorator("bottom-script-container"));

	// Mount pages
	mountPage("/home", OverviewPage.class);
	mountPage("/reports", ReportsPage.class);
	mountPage("/useractivity", UserActivityPage.class);
	mountPage("/preferences", PreferencesPage.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;
			}
		});
	}

	// Encrypt URLs. This immediately sets up a session (note that things like CSS now becomes bound to the session)
	getSecuritySettings().setCryptFactory(new KeyInSessionSunJceCryptFactory()); // Different key per user
	final IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this); 
	setRootRequestMapper(cryptoMapper);
}
 
Example #8
Source File: SiteStatsApplication.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
@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);

	// configure bottom page script loading
	setHeaderResponseDecorator(new JavaScriptToBucketResponseDecorator("bottom-script-container"));

	// Mount pages
	mountPage("/home", OverviewPage.class);
	mountPage("/reports", ReportsPage.class);
	mountPage("/useractivity", UserActivityPage.class);
	mountPage("/preferences", PreferencesPage.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;
			}
		});
	}

	// Encrypt URLs. This immediately sets up a session (note that things like CSS now becomes bound to the session)
	getSecuritySettings().setCryptFactory(new KeyInSessionSunJceCryptFactory()); // Different key per user
	final IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this); 
	setRootRequestMapper(cryptoMapper);
}