org.sonar.api.web
Class AbstractDashboardWidget

java.lang.Object
  extended by 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.


Constructor Summary
AbstractDashboardWidget()
           
 
Method Summary
 java.lang.String getTemplate()
           
protected abstract  java.lang.String getTemplatePath()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDashboardWidget

public AbstractDashboardWidget()
Method Detail

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.