org.sonar.api.web
Class AbstractDashboardWidget
java.lang.Object
org.sonar.api.web.AbstractDashboardWidget
- All Implemented Interfaces:
- Extension, ServerExtension, DashboardWidget
public abstract class AbstractDashboardWidget
- extends java.lang.Object
- implements DashboardWidget
It's useful in development environment to see browser rendering in real time while editing the template. To do that, just
override the method getTemplate()
:
public String getTemplate() {
try {
return FileUtils.readFileToString(new File("/tmp/sample_dashboard_widget.erb"), "UTF-8");
} catch (IOException e) {
throw new SonarException("Can not load the file");
}
}
Build and deploy the plugin in /extensions/plugins. The file /tmp/sample_dashboard_widget.erb will be reloaded on each request.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractDashboardWidget
public AbstractDashboardWidget()
getTemplate
public java.lang.String getTemplate()
- Specified by:
getTemplate
in interface DashboardWidget
- Returns:
- content of the JRuby on Rails template
getTemplatePath
protected abstract java.lang.String getTemplatePath()
- Returns:
- the classloader path of the template, for example "/org/sonar/my_template.erb".
Copyright © 2009 SonarSource SA. All Rights Reserved.