Package com.hybris.cockpitng.core.ui
Interface WidgetInstanceFacade
-
- All Known Implementing Classes:
AdminWidgetInstanceFacade,DefaultWidgetInstanceFacade
public interface WidgetInstanceFacadeA facade for managing widget instances. This interface is designed to be used by the widget engine. Implementation can contain lazy loading of widget instances and hide the details from the engine.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanCreateInstance(Widget widget, WidgetInstance parentInstance)Checks if a new instance of the given widget can be created.booleancanRemoveInstance(WidgetInstance instance)Checks if the given instance can be removed.WidgetInstancecreateWidgetInstance(Widget widget, WidgetInstance parent)Creates new widget instance as a child of the given parent.WidgetInstancecreateWidgetInstance(Widget widget, WidgetInstance parentInstance, java.lang.Object creator)Creates new widget instance as a child of the given parent with assigned creator.java.util.List<Widget>getPossibleWidgets(WidgetInstance parentInstance, java.lang.String slotId)Returns a list of all possible widgets that instances can be created of.WidgetInstancegetRootWidgetInstance(Widget widget)Returns a widget instance for the given root widget.java.util.List<WidgetInstance>getWidgetInstances(WidgetInstance parent)Returns a list of all child widget instances of the given parent.java.util.List<WidgetInstance>getWidgetInstances(WidgetInstance parent, java.lang.String slotId, boolean isSingleSlot)Returns a list of all instances of the given widget belonging to the given parent and assigned to the given slotId.java.util.List<WidgetInstance>getWidgetInstances(Widget widget, WidgetInstance parent)Returns a list of all instances of the given widget belonging to the given parent.voidremoveWidgetInstance(WidgetInstance instance)Removes given widget instance from the widget tree.
-
-
-
Method Detail
-
getRootWidgetInstance
WidgetInstance getRootWidgetInstance(Widget widget)
Returns a widget instance for the given root widget.- Parameters:
widget- the widget from which root is returned- Returns:
- the root widget instance
-
getWidgetInstances
java.util.List<WidgetInstance> getWidgetInstances(WidgetInstance parent)
Returns a list of all child widget instances of the given parent.- Parameters:
parent- WidgetInstance based on which child instances are returned- Returns:
- child widget instances
-
getWidgetInstances
java.util.List<WidgetInstance> getWidgetInstances(WidgetInstance parent, java.lang.String slotId, boolean isSingleSlot)
Returns a list of all instances of the given widget belonging to the given parent and assigned to the given slotId.- Parameters:
isSingleSlot- whether slot is single or notparent- the WidgetInstance from which Widget Instances will be returnedslotId- assigned slotId from which slot instances will be returned- Returns:
- list of all instances of the given widget belonging to the given parent and assigned to the given slotId
-
getWidgetInstances
java.util.List<WidgetInstance> getWidgetInstances(Widget widget, WidgetInstance parent)
Returns a list of all instances of the given widget belonging to the given parent.- Parameters:
parent- the WidgetInstance from which Widget Instances will be returnedwidget- the parent from which instances will be returned- Returns:
- child widget instances
-
createWidgetInstance
WidgetInstance createWidgetInstance(Widget widget, WidgetInstance parent)
Creates new widget instance as a child of the given parent.- Parameters:
parent- Widget Instance in which new widget instance will be createdwidget- a widget to create widget instance- Returns:
- created Widget Instance
-
createWidgetInstance
WidgetInstance createWidgetInstance(Widget widget, WidgetInstance parentInstance, java.lang.Object creator)
Creates new widget instance as a child of the given parent with assigned creator.- Parameters:
creator- assigned creatorparentInstance- Widget Instance in which new widget instance will be createdwidget- a widget to create widget instance- Returns:
- created Widget Instance
-
removeWidgetInstance
void removeWidgetInstance(WidgetInstance instance)
Removes given widget instance from the widget tree. View model will be removed as well. All child instances will be removed as well.- Parameters:
instance- Widget Instance to be removed form the widget tree
-
canCreateInstance
boolean canCreateInstance(Widget widget, WidgetInstance parentInstance)
Checks if a new instance of the given widget can be created. It might be disabled by user visibility rule.- Parameters:
widget- check will be done if this widget can be createdparentInstance- Widget Instance in which creation possibility will be tested- Returns:
- true if a given widget instance can be created
-
canRemoveInstance
boolean canRemoveInstance(WidgetInstance instance)
Checks if the given instance can be removed.- Parameters:
instance- test if this instance can be removed- Returns:
- true if removal is possible
-
getPossibleWidgets
java.util.List<Widget> getPossibleWidgets(WidgetInstance parentInstance, java.lang.String slotId)
Returns a list of all possible widgets that instances can be created of.- Parameters:
parentInstance- Widget Instance in which Widgets could be possibly createdslotId- slotId name in which Widgets could be possibly created- Returns:
- a list of all possible widgets that instances can be created of
-
-