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
View element that can access to other view items
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addViewItem
(ViewItem item) Add a view item in the accessorvoid
clear()
Removes all items of this accessorvoid
Copy the current view item in the given one.Create an instance ofViewItem
boolean
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 accessortoString()
Methods inherited from class org.ametys.runtime.model.ViewElement
copyTo, equals, getDefinition, getDescription, getLabel, getName, getParent, setDefinition, setDescription, setLabel, setParent, 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, getViewItem, hasModelViewItem, hasModelViewItem, hasModelViewItem
-
Constructor Details
-
ViewElementAccessor
public ViewElementAccessor()
-
-
Method Details
-
getViewItems
Description copied from interface:ViewItemAccessor
Retrieves all the view items of this accessor- Specified by:
getViewItems
in interfaceViewItemAccessor
- Returns:
- the view items
-
addViewItem
Description copied from interface:ViewItemAccessor
Add a view item in the accessor- Specified by:
addViewItem
in interfaceViewItemAccessor
- Parameters:
item
- the item to add
-
insertViewItem
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
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
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
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
Description copied from interface:ViewItem
Create an instance ofViewItem
- Specified by:
createInstance
in interfaceViewItem
- Overrides:
createInstance
in classViewElement
- Returns:
- the created instance
-
hashCode
- Overrides:
hashCode
in classViewElement
-
equals
- Overrides:
equals
in classViewElement
-
toString
- Overrides:
toString
in classViewElement
-