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 void
addViewItem(ViewItem item)
Add a view item in the accessorvoid
clear()
Removes all items of this accessorvoid
copyTo(ViewItem item, View referenceView, String itemPath)
Copy the current view item in the given one.ViewElementAccessor
createInstance()
Create an instance ofViewItem
boolean
equals(Object obj)
List<ViewItem>
getViewItems()
Retrieves all the view items of this accessorint
hashCode()
void
insertViewItem(ViewItem item, int index)
Insert a view item in the accessor at the given indexstatic ViewElementAccessor
of(ModelItemAccessor modelItemAccessor)
Creates aViewElementAccessor
with the items of the givenModelItemAccessor
static ViewElementAccessor
of(ModelItemGroup modelItemAccessor, String... itemPaths)
Creates aViewElementAccessor
with the given itemsboolean
removeViewItem(ViewItem item)
Removes the given items of this accessorString
toString()
-
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:ViewItemAccessor
Retrieves all the view items of this accessor- Specified by:
getViewItems
in interfaceViewItemAccessor
- Returns:
- the view items
-
addViewItem
public void addViewItem(ViewItem item)
Description copied from interface:ViewItemAccessor
Add a view item in the accessor- Specified by:
addViewItem
in interfaceViewItemAccessor
- Parameters:
item
- the item to add
-
insertViewItem
public void insertViewItem(ViewItem item, int index)
Description copied from interface:ViewItemAccessor
Insert a view item in the accessor at the given index- Specified by:
insertViewItem
in 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:ViewItemAccessor
Removes the given items of this accessor- Specified by:
removeViewItem
in interfaceViewItemAccessor
- Parameters:
item
- the item to remove- Returns:
true
if this accessor contained the given item,false
otherwise
-
clear
public void clear()
Description copied from interface:ViewItemAccessor
Removes all items of this accessor- Specified by:
clear
in interfaceViewItemAccessor
-
of
public static ViewElementAccessor of(ModelItemAccessor modelItemAccessor) throws IllegalArgumentException
Creates aViewElementAccessor
with 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 aViewElementAccessor
with 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 isnull
or 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:ViewItem
Copy 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:ViewItem
Create an instance ofViewItem
- Specified by:
createInstance
in interfaceViewItem
- Overrides:
createInstance
in classViewElement
- Returns:
- the created instance
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classViewElement
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classViewElement
-
toString
public String toString()
- Overrides:
toString
in classViewElement
-
-