Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.theme.webwidgets.providers
Class DefaultProvider

java.lang.Object
  extended by org.nuxeo.theme.webwidgets.providers.DefaultProvider
All Implemented Interfaces:
Provider

public class DefaultProvider
extends Object
implements Provider


Constructor Summary
DefaultProvider()
           
 
Method Summary
 void activate()
          Activate a provider.
 void addWidget(Widget widget, String regionName, int order)
          Add a widget to a region.
 boolean canRead()
          Check for read access.
 boolean canWrite()
          Check write access.
 Widget createWidget(String widgetTypeName)
          Create a new widget.
 void deactivate()
          Deactivate a provider.
 void deleteWidgetData(Widget widget)
          Delete all data associated with a widget
 void destroy()
          Destroy a provider.
 DefaultProviderSession getDefaultProviderSession()
           
 String getRegionOfWidget(Widget widget)
          Get the region of a widget.
 Widget getWidgetByUid(String uid)
          Get a widget by its id.
 WidgetData getWidgetData(Widget widget, String dataName)
          Get the data of a widget
 Map<String,String> getWidgetPreferences(Widget widget)
          Get the preferences of a widget.
 List<Widget> getWidgets(String regionName)
          Get the list of widgets in a region.
 WidgetState getWidgetState(Widget widget)
          Get the state of a widget.
 void moveWidget(Widget widget, String destRegionName, int order)
          Move a widget to another region.
 void removeWidget(Widget widget)
          Remove a widget.
 void reorderWidget(Widget widget, int order)
          Reorder a widget.
 void setWidgetData(Widget widget, String dataName, WidgetData data)
          Set data to a widget
 void setWidgetPreferences(Widget widget, Map<String,String> preferences)
          Set the preferences of a widget.
 void setWidgetState(Widget widget, WidgetState state)
          Set the state of a widget.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultProvider

public DefaultProvider()
Method Detail

activate

public void activate()
Description copied from interface: Provider
Activate a provider. The implementation is responsible for acquiring resources needed for service

Specified by:
activate in interface Provider

deactivate

public void deactivate()
Description copied from interface: Provider
Deactivate a provider. The implementation is responsible for releasing resources used by the service.

Specified by:
deactivate in interface Provider

destroy

public void destroy()
Description copied from interface: Provider
Destroy a provider. The implementation is responsible for destroying all the resources used by the service.

Specified by:
destroy in interface Provider

getDefaultProviderSession

public DefaultProviderSession getDefaultProviderSession()

createWidget

public Widget createWidget(String widgetTypeName)
                    throws ProviderException
Description copied from interface: Provider
Create a new widget. The implementation is responsible for generating a unique widget identifier.

Specified by:
createWidget in interface Provider
Parameters:
widgetTypeName - the widget type name
Returns:
the created widget
Throws:
ProviderException

getWidgetByUid

public Widget getWidgetByUid(String uid)
                      throws ProviderException
Description copied from interface: Provider
Get a widget by its id.

Specified by:
getWidgetByUid in interface Provider
Parameters:
uid - the widget's unique identifier
Returns:
the widget or null if the identifier does not match any widget
Throws:
ProviderException

getWidgets

public List<Widget> getWidgets(String regionName)
                        throws ProviderException
Description copied from interface: Provider
Get the list of widgets in a region.

Specified by:
getWidgets in interface Provider
Parameters:
regionName - the name of the region from which to get the list of widgets
Returns:
an ordered list of widgets located in the specified region
Throws:
ProviderException

addWidget

public void addWidget(Widget widget,
                      String regionName,
                      int order)
               throws ProviderException
Description copied from interface: Provider
Add a widget to a region.

Specified by:
addWidget in interface Provider
Parameters:
widget - the widget to add
regionName - the name of the region
order - the order at which to insert the widget (begins with 0)
Throws:
ProviderException

moveWidget

public void moveWidget(Widget widget,
                       String destRegionName,
                       int order)
                throws ProviderException
Description copied from interface: Provider
Move a widget to another region.

Specified by:
moveWidget in interface Provider
Parameters:
widget - the widget to move
destRegionName - the name of the destination region
order - the order at which to insert the widget
Throws:
ProviderException

reorderWidget

public void reorderWidget(Widget widget,
                          int order)
                   throws ProviderException
Description copied from interface: Provider
Reorder a widget.

Specified by:
reorderWidget in interface Provider
Parameters:
widget - the widget to reorder
order - the new order
Throws:
ProviderException

removeWidget

public void removeWidget(Widget widget)
                  throws ProviderException
Description copied from interface: Provider
Remove a widget. The implementation is responsible for removing from the widget from the region in which it is located and for destroying the widget.

Specified by:
removeWidget in interface Provider
Parameters:
widget - the widget to remove
Throws:
ProviderException

getRegionOfWidget

public String getRegionOfWidget(Widget widget)
                         throws ProviderException
Description copied from interface: Provider
Get the region of a widget.

Specified by:
getRegionOfWidget in interface Provider
Parameters:
widget - the widget to get the region of
Returns:
the name of the region or null if the widget does not exist.
Throws:
ProviderException

getWidgetPreferences

public Map<String,String> getWidgetPreferences(Widget widget)
                                        throws ProviderException
Description copied from interface: Provider
Get the preferences of a widget.

Specified by:
getWidgetPreferences in interface Provider
Parameters:
widget - the widget whose preferences are to be obtained
Returns:
a mapping of preferences as
Throws:
ProviderException

setWidgetPreferences

public void setWidgetPreferences(Widget widget,
                                 Map<String,String> preferences)
                          throws ProviderException
Description copied from interface: Provider
Set the preferences of a widget. Existing preferences are replaced.

Specified by:
setWidgetPreferences in interface Provider
Parameters:
widget - the widget whose preferences will be set
preferences - a mapping of preferences as
Throws:
ProviderException

setWidgetState

public void setWidgetState(Widget widget,
                           WidgetState state)
                    throws ProviderException
Description copied from interface: Provider
Set the state of a widget.

Specified by:
setWidgetState in interface Provider
Parameters:
widget - the widget whose state is to be set
state - the state to set (see $WidgetState)
Throws:
ProviderException

getWidgetState

public WidgetState getWidgetState(Widget widget)
                           throws ProviderException
Description copied from interface: Provider
Get the state of a widget.

Specified by:
getWidgetState in interface Provider
Parameters:
widget - the widget whose state is to be obtained
Returns:
the state (see $WidgetState)
Throws:
ProviderException

getWidgetData

public WidgetData getWidgetData(Widget widget,
                                String dataName)
                         throws ProviderException
Description copied from interface: Provider
Get the data of a widget

Specified by:
getWidgetData in interface Provider
Parameters:
widget - the widget from which to get the data
dataName - the name of the data
Returns:
Throws:
ProviderException

setWidgetData

public void setWidgetData(Widget widget,
                          String dataName,
                          WidgetData data)
                   throws ProviderException
Description copied from interface: Provider
Set data to a widget

Specified by:
setWidgetData in interface Provider
Parameters:
widget - the widget to set data to
dataName - the name of the data
data - the widget data
Throws:
ProviderException

deleteWidgetData

public void deleteWidgetData(Widget widget)
                      throws ProviderException
Description copied from interface: Provider
Delete all data associated with a widget

Specified by:
deleteWidgetData in interface Provider
Parameters:
widget - the widget
Throws:
ProviderException

canRead

public boolean canRead()
Description copied from interface: Provider
Check for read access.

Specified by:
canRead in interface Provider
Returns:
true if the current principal can read information from this provider.

canWrite

public boolean canWrite()
Description copied from interface: Provider
Check write access.

Specified by:
canWrite in interface Provider
Returns:
true if the current principal can write information to this provider.

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.