org.sonar.api.web.gwt.client
Class AbstractViewer

java.lang.Object
  extended by org.sonar.api.web.gwt.client.AbstractViewer
All Implemented Interfaces:
com.google.gwt.core.client.EntryPoint

public abstract class AbstractViewer
extends Object
implements com.google.gwt.core.client.EntryPoint


Nested Class Summary
 class AbstractViewer.StandAloneResourceHandler
           
 
Field Summary
static String HTML_ROOT_ID
           
 
Constructor Summary
AbstractViewer()
           
 
Method Summary
protected abstract  void exportJavascript()
          Export GWT javascript methods to load and control the plugin, must export currently 2 method : I.E for plugin GWT id : foo.bar.MyPlugin, class foo.bar.client.MyPlugin :

$wnd.load_foo_bar_MyPlugin = function() { called to the plugin init from JS obj.@foo.bar.client.MyPlugin::loadContainer()(); } $wnd.on_resource_loaded_foo_bar_MyPlugin = function() { called when a resource JSON object has been refreshed within the page obj.@foo.bar.client.MyPlugin::onResourceLoaded()(); }

protected abstract  String getGwtId()
          Return the GWT id of the widget
 Resource getResource()
           
protected  com.google.gwt.core.client.JavaScriptObject getResourceJSONObject()
          Return a JavaScriptObject object containing all the measure available for the current resource key
protected abstract  boolean isDefault(WSMetrics.Metric metric, Resource resource)
          When multiple widgets are bound to the same HTML div, this method will indicate If the resource widget is the default one to show when the widget is initialized
protected abstract  boolean isForResource(Resource resource)
          When multiple widgets are in the same page, this method will indicate if the widget can be shown for the given resource
protected  boolean isMetricInList(WSMetrics.Metric metric, WSMetrics.Metric... metricsList)
          Finds if a given metric is in the provided metrics list
 void loadContainer()
          Called to render the widget for the given resource object loaded via the onResourceLoaded() method call
 void onModuleLoad()
           
 void onResourceLoaded()
          Called when a resource JSON object has been loaded within the page
protected abstract  com.google.gwt.user.client.ui.Widget render(Resource resource)
          Renders the widget for the current resource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTML_ROOT_ID

public static final String HTML_ROOT_ID
See Also:
Constant Field Values
Constructor Detail

AbstractViewer

public AbstractViewer()
Method Detail

onModuleLoad

public void onModuleLoad()
Specified by:
onModuleLoad in interface com.google.gwt.core.client.EntryPoint

exportJavascript

protected abstract void exportJavascript()
Export GWT javascript methods to load and control the plugin, must export currently 2 method : I.E for plugin GWT id : foo.bar.MyPlugin, class foo.bar.client.MyPlugin :

$wnd.load_foo_bar_MyPlugin = function() { called to the plugin init from JS obj.@foo.bar.client.MyPlugin::loadContainer()(); } $wnd.on_resource_loaded_foo_bar_MyPlugin = function() { called when a resource JSON object has been refreshed within the page obj.@foo.bar.client.MyPlugin::onResourceLoaded()(); }


isDefault

protected abstract boolean isDefault(WSMetrics.Metric metric,
                                     Resource resource)
When multiple widgets are bound to the same HTML div, this method will indicate If the resource widget is the default one to show when the widget is initialized

Parameters:
metric - the metric for which the widget is shown, cannot be null
resource - the resource bound to the widget
Returns:
true or false

isMetricInList

protected boolean isMetricInList(WSMetrics.Metric metric,
                                 WSMetrics.Metric... metricsList)
Finds if a given metric is in the provided metrics list

Parameters:
metric - the metric to search
metricsList - the metric list
Returns:
true or false if not found

isForResource

protected abstract boolean isForResource(Resource resource)
When multiple widgets are in the same page, this method will indicate if the widget can be shown for the given resource

Parameters:
resource - the resource bound to the page
Returns:
true or false

getResource

public Resource getResource()

onResourceLoaded

public final void onResourceLoaded()
Called when a resource JSON object has been loaded within the page


loadContainer

public final void loadContainer()
Called to render the widget for the given resource object loaded via the onResourceLoaded() method call


getGwtId

protected abstract String getGwtId()
Return the GWT id of the widget


render

protected abstract com.google.gwt.user.client.ui.Widget render(Resource resource)
Renders the widget for the current resource


getResourceJSONObject

protected com.google.gwt.core.client.JavaScriptObject getResourceJSONObject()
Return a JavaScriptObject object containing all the measure available for the current resource key

Returns:
the JavaScriptObject instance, should never be null


Copyright © 2009-2010 SonarSource SA. All Rights Reserved.