Package org.ametys.runtime.model
Class ViewElementAccessor
- java.lang.Object
-
- org.ametys.runtime.model.ViewElement
-
- org.ametys.runtime.model.ViewElementAccessor
-
- All Implemented Interfaces:
ModelViewItem<ElementDefinition>,ViewItem,ViewItemAccessor,Labelable,ModifiableLabelable
public class ViewElementAccessor extends ViewElement implements ViewItemAccessor
View element that can access to other view items
-
-
Constructor Summary
Constructors Constructor Description ViewElementAccessor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddViewItem(ViewItem item)Add a view item in the accessorvoidclear()Removes all items of this accessorvoidcopyTo(ViewItem item, View referenceView, String itemPath)Copy the current view item in the given one.ViewElementAccessorcreateInstance()Create an instance ofViewItembooleanequals(Object obj)List<ViewItem>getViewItems()Retrieves all the view items of this accessorinthashCode()voidinsertViewItem(ViewItem item, int index)Insert a view item in the accessor at the given indexstatic ViewElementAccessorof(ModelItemAccessor modelItemAccessor)Creates aViewElementAccessorwith the items of the givenModelItemAccessorstatic ViewElementAccessorof(ModelItemGroup modelItemAccessor, String... itemPaths)Creates aViewElementAccessorwith the given itemsbooleanremoveViewItem(ViewItem item)Removes the given items of this accessorStringtoString()-
Methods inherited from class org.ametys.runtime.model.ViewElement
copyTo, equals, getDefinition, getDescription, getLabel, getName, setDefinition, setDescription, setLabel, toJSON, toSAX
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ametys.runtime.model.ModelViewItem
setName
-
Methods inherited from interface org.ametys.runtime.model.ViewItemAccessor
addViewItems, getModelViewItem, hasModelViewItem, hasModelViewItem, hasModelViewItem
-
-
-
-
Constructor Detail
-
ViewElementAccessor
public ViewElementAccessor()
-
-
Method Detail
-
getViewItems
public List<ViewItem> getViewItems()
Description copied from interface:ViewItemAccessorRetrieves all the view items of this accessor- Specified by:
getViewItemsin interfaceViewItemAccessor- Returns:
- the view items
-
addViewItem
public void addViewItem(ViewItem item)
Description copied from interface:ViewItemAccessorAdd a view item in the accessor- Specified by:
addViewItemin interfaceViewItemAccessor- Parameters:
item- the item to add
-
insertViewItem
public void insertViewItem(ViewItem item, int index)
Description copied from interface:ViewItemAccessorInsert a view item in the accessor at the given index- Specified by:
insertViewItemin interfaceViewItemAccessor- Parameters:
item- the item to insertindex- index at which the item has to be inserted
-
removeViewItem
public boolean removeViewItem(ViewItem item)
Description copied from interface:ViewItemAccessorRemoves the given items of this accessor- Specified by:
removeViewItemin interfaceViewItemAccessor- Parameters:
item- the item to remove- Returns:
trueif this accessor contained the given item,falseotherwise
-
clear
public void clear()
Description copied from interface:ViewItemAccessorRemoves all items of this accessor- Specified by:
clearin interfaceViewItemAccessor
-
of
public static ViewElementAccessor of(ModelItemAccessor modelItemAccessor) throws IllegalArgumentException
Creates aViewElementAccessorwith the items of the givenModelItemAccessor- Parameters:
modelItemAccessor- the model item accessor- Returns:
- the created
ViewElementAccessor - Throws:
IllegalArgumentException- if the model item accessor isnull
-
of
public static ViewElementAccessor of(ModelItemGroup modelItemAccessor, String... itemPaths) throws IllegalArgumentException, BadItemTypeException
Creates aViewElementAccessorwith the given items- Parameters:
modelItemAccessor- the model item accessing the items definitionsitemPaths- the paths of the items to put in the view item- Returns:
- the created
ViewElementAccessor - Throws:
IllegalArgumentException- if the model item accessor isnullor if an item path isnull, empty, or is not defined in the given model itemsBadItemTypeException- if a segment in a path (but not the last) does not represent a group item
-
copyTo
public void copyTo(ViewItem item, View referenceView, String itemPath)
Description copied from interface:ViewItemCopy the current view item in the given one. If the view item is an accessor, its view items are copied only if they are not already present in the reference view
-
createInstance
public ViewElementAccessor createInstance()
Description copied from interface:ViewItemCreate an instance ofViewItem- Specified by:
createInstancein interfaceViewItem- Overrides:
createInstancein classViewElement- Returns:
- the created instance
-
hashCode
public int hashCode()
- Overrides:
hashCodein classViewElement
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classViewElement
-
toString
public String toString()
- Overrides:
toStringin classViewElement
-
-