Package com.hybris.cockpitng.engine.impl
Class DefaultWidgetInstanceFacade
- java.lang.Object
-
- com.hybris.cockpitng.engine.impl.DefaultWidgetInstanceFacade
-
- All Implemented Interfaces:
WidgetInstanceFacade
- Direct Known Subclasses:
AdminWidgetInstanceFacade
public class DefaultWidgetInstanceFacade extends java.lang.Object implements WidgetInstanceFacade
Implementation of the WidgetInstanceFacade for the default widget engine.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCHILD_INDEX
-
Constructor Summary
Constructors Constructor Description DefaultWidgetInstanceFacade()
-
Method Summary
All Methods Instance Methods Concrete 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 parentInstance)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 rootWidget)Returns a widget instance for the given root widget.java.util.Comparator<Widget>getWidgetIndexComparator()java.util.List<WidgetInstance>getWidgetInstances(WidgetInstance parentInstance)Returns a list of all child widget instances of the given parent.java.util.List<WidgetInstance>getWidgetInstances(WidgetInstance parentInstance, 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 parentInstance)Returns a list of all instances of the given widget belonging to the given parent.WidgetInstanceServicegetWidgetInstanceService()voidremoveWidgetInstance(WidgetInstance instance)Removes given widget instance from the widget tree.voidsetWidgetIndexComparator(java.util.Comparator<Widget> widgetIndexComparator)voidsetWidgetInstanceService(WidgetInstanceService widgetInstanceService)
-
-
-
Field Detail
-
CHILD_INDEX
public static final java.lang.String CHILD_INDEX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRootWidgetInstance
public WidgetInstance getRootWidgetInstance(Widget rootWidget)
Description copied from interface:WidgetInstanceFacadeReturns a widget instance for the given root widget.- Specified by:
getRootWidgetInstancein interfaceWidgetInstanceFacade- Parameters:
rootWidget- the widget from which root is returned- Returns:
- the root widget instance
-
getWidgetInstances
public java.util.List<WidgetInstance> getWidgetInstances(WidgetInstance parentInstance, java.lang.String slotId, boolean isSingleSlot)
Description copied from interface:WidgetInstanceFacadeReturns a list of all instances of the given widget belonging to the given parent and assigned to the given slotId.- Specified by:
getWidgetInstancesin interfaceWidgetInstanceFacade- Parameters:
parentInstance- the WidgetInstance from which Widget Instances will be returnedslotId- assigned slotId from which slot instances will be returnedisSingleSlot- whether slot is single or not- Returns:
- list of all instances of the given widget belonging to the given parent and assigned to the given slotId
-
getWidgetInstances
public java.util.List<WidgetInstance> getWidgetInstances(WidgetInstance parentInstance)
Description copied from interface:WidgetInstanceFacadeReturns a list of all child widget instances of the given parent.- Specified by:
getWidgetInstancesin interfaceWidgetInstanceFacade- Parameters:
parentInstance- WidgetInstance based on which child instances are returned- Returns:
- child widget instances
-
getWidgetInstances
public java.util.List<WidgetInstance> getWidgetInstances(Widget widget, WidgetInstance parentInstance)
Description copied from interface:WidgetInstanceFacadeReturns a list of all instances of the given widget belonging to the given parent.- Specified by:
getWidgetInstancesin interfaceWidgetInstanceFacade- Parameters:
widget- the parent from which instances will be returnedparentInstance- the WidgetInstance from which Widget Instances will be returned- Returns:
- child widget instances
-
createWidgetInstance
public WidgetInstance createWidgetInstance(Widget widget, WidgetInstance parentInstance, java.lang.Object creator)
Description copied from interface:WidgetInstanceFacadeCreates new widget instance as a child of the given parent with assigned creator.- Specified by:
createWidgetInstancein interfaceWidgetInstanceFacade- Parameters:
widget- a widget to create widget instanceparentInstance- Widget Instance in which new widget instance will be createdcreator- assigned creator- Returns:
- created Widget Instance
-
createWidgetInstance
public WidgetInstance createWidgetInstance(Widget widget, WidgetInstance parentInstance)
Description copied from interface:WidgetInstanceFacadeCreates new widget instance as a child of the given parent.- Specified by:
createWidgetInstancein interfaceWidgetInstanceFacade- Parameters:
widget- a widget to create widget instanceparentInstance- Widget Instance in which new widget instance will be created- Returns:
- created Widget Instance
-
removeWidgetInstance
public void removeWidgetInstance(WidgetInstance instance)
Description copied from interface:WidgetInstanceFacadeRemoves given widget instance from the widget tree. View model will be removed as well. All child instances will be removed as well.- Specified by:
removeWidgetInstancein interfaceWidgetInstanceFacade- Parameters:
instance- Widget Instance to be removed form the widget tree
-
canCreateInstance
public boolean canCreateInstance(Widget widget, WidgetInstance parentInstance)
Description copied from interface:WidgetInstanceFacadeChecks if a new instance of the given widget can be created. It might be disabled by user visibility rule.- Specified by:
canCreateInstancein interfaceWidgetInstanceFacade- 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
public boolean canRemoveInstance(WidgetInstance instance)
Description copied from interface:WidgetInstanceFacadeChecks if the given instance can be removed.- Specified by:
canRemoveInstancein interfaceWidgetInstanceFacade- Parameters:
instance- test if this instance can be removed- Returns:
- true if removal is possible
-
getPossibleWidgets
public java.util.List<Widget> getPossibleWidgets(WidgetInstance parentInstance, java.lang.String slotId)
Description copied from interface:WidgetInstanceFacadeReturns a list of all possible widgets that instances can be created of.- Specified by:
getPossibleWidgetsin interfaceWidgetInstanceFacade- 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
-
getWidgetInstanceService
public WidgetInstanceService getWidgetInstanceService()
-
setWidgetInstanceService
public void setWidgetInstanceService(WidgetInstanceService widgetInstanceService)
-
getWidgetIndexComparator
public java.util.Comparator<Widget> getWidgetIndexComparator()
-
setWidgetIndexComparator
public void setWidgetIndexComparator(java.util.Comparator<Widget> widgetIndexComparator)
-
-