org.sonar.api.web
Class Dashboard

java.lang.Object
  extended by org.sonar.api.web.Dashboard

public final class Dashboard
extends Object

Definition of a dashboard.

Its name and description can be retrieved using the i18n mechanism, using the keys "dashboard.<id>.name" and "dashboard.<id>.description".

Since:
2.13

Nested Class Summary
static class Dashboard.Widget
          Note that this class is an inner class to avoid confusion with the extension point org.sonar.api.web.Widget.
 
Method Summary
 Dashboard.Widget addWidget(String widgetId, int columnId)
          Add a widget with the given parameters, and return the newly created Dashboard.Widget object if one wants to add parameters to it.
static Dashboard create()
          Creates a new Dashboard.
 String getDescription()
          Returns the description of the dashboard.
 DashboardLayout getLayout()
          Returns the layout.
 Collection<Dashboard.Widget> getWidgets()
           
 List<Dashboard.Widget> getWidgetsOfColumn(int columnId)
           
 boolean isActivated()
          A dashboard can be activated for all anonymous users or users who haven't configured their own dashboards.
 boolean isGlobal()
          A dashboard is global when it doesn't display information from a projet but rather more general information.
 Dashboard setActivated(boolean activated)
          Set whether the dashboard is activated for all anonymous users or users who haven't configured their own dashboards.
 Dashboard setDescription(String description)
          Sets the description of the dashboard.
 Dashboard setGlobal(boolean global)
          A dashboard is global when it doesn't display information from a projet but rather more general information.
 Dashboard setLayout(DashboardLayout dl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static Dashboard create()
Creates a new Dashboard.


addWidget

public Dashboard.Widget addWidget(String widgetId,
                                  int columnId)
Add a widget with the given parameters, and return the newly created Dashboard.Widget object if one wants to add parameters to it.

The widget ids are listed by the web service /api/widgets

Parameters:
widgetId - id of an existing widget
columnId - column starts with 1. The widget is ignored if the column id does not match the layout.

getWidgets

public Collection<Dashboard.Widget> getWidgets()

getWidgetsOfColumn

public List<Dashboard.Widget> getWidgetsOfColumn(int columnId)

getDescription

public String getDescription()
Returns the description of the dashboard.

Returns:
the description

setDescription

public Dashboard setDescription(String description)
Sets the description of the dashboard.

Note: you should use the i18n mechanism for the description.

Parameters:
description - the description to set

getLayout

public DashboardLayout getLayout()
Returns the layout. Default value is the 2 columns mode with width 50%/50%.

Returns:
the layout

setLayout

public Dashboard setLayout(DashboardLayout dl)

isGlobal

public boolean isGlobal()
A dashboard is global when it doesn't display information from a projet but rather more general information.

Before version 3.1 no dashboard was global.

Since:
3.1

setGlobal

public Dashboard setGlobal(boolean global)
A dashboard is global when it doesn't display information from a projet but rather more general information.

Before version 3.1 no dashboard was global.

Since:
3.1

isActivated

public boolean isActivated()
A dashboard can be activated for all anonymous users or users who haven't configured their own dashboards.

Before version 3.1 every dashboard created through this extension point was automatically activated. This is still the default behavior.

Since:
3.1

setActivated

public Dashboard setActivated(boolean activated)
Set whether the dashboard is activated for all anonymous users or users who haven't configured their own dashboards.

Since:
3.1


Copyright © 2009-2014 SonarSource. All Rights Reserved.