Package org.ametys.runtime.model
Class ModelViewItemGroup
- java.lang.Object
-
- org.ametys.runtime.model.AbstractViewItemGroup
-
- org.ametys.runtime.model.ModelViewItemGroup
-
- All Implemented Interfaces:
ModelViewItem<ModelItemGroup>
,ViewItem
,ViewItemAccessor
,ViewItemContainer
,ViewItemGroup
,Labelable
,ModifiableLabelable
public class ModelViewItemGroup extends AbstractViewItemGroup implements ModelViewItem<ModelItemGroup>
View reference to a group of model items
-
-
Field Summary
-
Fields inherited from class org.ametys.runtime.model.AbstractViewItemGroup
_children, _description, _label, _role
-
Fields inherited from interface org.ametys.runtime.model.ViewItemGroup
FIELDSET_ROLE, TAB_ROLE
-
-
Constructor Summary
Constructors Constructor Description ModelViewItemGroup()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyTo(ViewItem item)
Copy the current view item in the given one.ModelViewItemGroup
createInstance()
Create an instance ofViewItem
boolean
equals(Object obj)
ModelItemGroup
getDefinition()
Retrieves the referenced model item definitionI18nizableText
getDescription()
Retrieves the description.I18nizableText
getLabel()
Retrieves the label.String
getName()
Get the name.int
hashCode()
static ModelViewItemGroup
of(ModelItemGroup modelItem)
Creates aModelViewItemGroup
with the items of the givenModelItemGroup
static ModelViewItemGroup
of(ModelItemGroup modelItem, String... itemPaths)
Creates aModelViewItemGroup
with the given itemsvoid
setDefinition(ModelItemGroup definition)
Sets the referenced model item definitionMap<String,Object>
toJSON(DefinitionContext context)
Converts the view item in a JSON mapvoid
toSAX(ContentHandler contentHandler, DefinitionContext context)
Generates SAX events for the view itemString
toString()
-
Methods inherited from class org.ametys.runtime.model.AbstractViewItemGroup
addViewItem, clear, equals, getRole, getViewItems, insertViewItem, removeViewItem, setDescription, setLabel, setRole
-
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.util.ModifiableLabelable
setDescription, setLabel
-
Methods inherited from interface org.ametys.runtime.model.ViewItemAccessor
addViewItems, getModelViewItem, hasModelViewItem, hasModelViewItem, hasModelViewItem
-
Methods inherited from interface org.ametys.runtime.model.ViewItemGroup
copyTo
-
-
-
-
Constructor Detail
-
ModelViewItemGroup
public ModelViewItemGroup()
-
-
Method Detail
-
of
public static ModelViewItemGroup of(ModelItemGroup modelItem) throws IllegalArgumentException
Creates aModelViewItemGroup
with the items of the givenModelItemGroup
- Parameters:
modelItem
- the model item group- Returns:
- the created
ModelViewItemGroup
- Throws:
IllegalArgumentException
- if the model item isnull
-
of
public static ModelViewItemGroup of(ModelItemGroup modelItem, String... itemPaths) throws IllegalArgumentException, BadItemTypeException
Creates aModelViewItemGroup
with the given items- Parameters:
modelItem
- the model item containing items definitionsitemPaths
- the paths of the items to put in the view item- Returns:
- the created
ModelViewItemGroup
- Throws:
IllegalArgumentException
- if the model item 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
-
getDefinition
public ModelItemGroup getDefinition()
Description copied from interface:ModelViewItem
Retrieves the referenced model item definition- Specified by:
getDefinition
in interfaceModelViewItem<ModelItemGroup>
- Returns:
- the referenced definition
-
setDefinition
public void setDefinition(ModelItemGroup definition)
Description copied from interface:ModelViewItem
Sets the referenced model item definition- Specified by:
setDefinition
in interfaceModelViewItem<ModelItemGroup>
- Parameters:
definition
- the referenced definition
-
getLabel
public I18nizableText getLabel()
Description copied from interface:Labelable
Retrieves the label.- Specified by:
getLabel
in interfaceLabelable
- Overrides:
getLabel
in classAbstractViewItemGroup
- Returns:
- the label.
-
getDescription
public I18nizableText getDescription()
Description copied from interface:Labelable
Retrieves the description.- Specified by:
getDescription
in interfaceLabelable
- Overrides:
getDescription
in classAbstractViewItemGroup
- Returns:
- the description.
-
toJSON
public Map<String,Object> toJSON(DefinitionContext context) throws ProcessingException
Description copied from interface:ViewItem
Converts the view item in a JSON map- Specified by:
toJSON
in interfaceViewItem
- Parameters:
context
- the context of the definitions referenced in this view item and/or its children- Returns:
- The view item as a JSON map
- Throws:
ProcessingException
- If an error occurs when converting the view item
-
toSAX
public void toSAX(ContentHandler contentHandler, DefinitionContext context) throws SAXException
Description copied from interface:ViewItem
Generates SAX events for the view item- Specified by:
toSAX
in interfaceViewItem
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventscontext
- the context of the definitions included in the view item- Throws:
SAXException
- if an error occurs during the SAX events generation
-
copyTo
public void copyTo(ViewItem item)
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 not copied- Specified by:
copyTo
in interfaceViewItem
- Overrides:
copyTo
in classAbstractViewItemGroup
- Parameters:
item
- the copy
-
createInstance
public ModelViewItemGroup createInstance()
Description copied from interface:ViewItem
Create an instance ofViewItem
- Specified by:
createInstance
in interfaceViewItem
- Returns:
- the created instance
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractViewItemGroup
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classAbstractViewItemGroup
-
-