Package org.ametys.runtime.model
Class View
java.lang.Object
org.ametys.runtime.model.View
- All Implemented Interfaces:
ViewItemAccessor
,ViewItemContainer
,Labelable
,ModifiableLabelable
View of 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 in the given one.boolean
boolean
Indicates whether some other object is "equal to" this one.Retrieves the description.Retrieves the CSS class to use for decorator above the main iconRetrieves the CSS class to use for glyph icongetLabel()
Retrieves the label.Retrieves the URL of the small icon without the context path.Retrieves the URL of the small icon without the context path.getName()
Get the name.Retrieves the URL of the small icon without the context path.Retrieves all the view items of this accessorint
hashCode()
void
includeView
(View viewToInclude) Include the given view to the current one.void
insertViewItem
(ViewItem item, int index) Insert a view item in the accessor at the given indexboolean
Determines if the view is for internal use onlystatic View
of
(Collection<? extends Model> models) static View
of
(Collection<? extends Model> models, String... itemPaths) Creates aView
with the given itemsstatic View
static View
Creates aView
with the given items.static View
Creates aView
with the given itemsboolean
removeViewItem
(ViewItem item) Removes the given items of this accessorvoid
setDescription
(I18nizableText description) Set the description.void
setIconDecorator
(String iconDecorator) Set the CSS class to use for decorator above the main iconvoid
setIconGlyph
(String iconGlyph) Set the CSS class to use for glyph iconvoid
setInternal
(boolean isInternal) Set the internal statusvoid
setLabel
(I18nizableText label) Set the label.void
setLargeIcon
(String largeIcon) Set the URL of the large icon.void
setMediumIcon
(String mediumIcon) Set the URL of the medium icon.void
Set the name.void
setSmallIcon
(String smallIcon) Set the URL of the small icon.toJSON
(DefinitionContext context) Converts the view in a JSON mapvoid
toSAX
(ContentHandler contentHandler, DefinitionContext context) Generates SAX events for the viewMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ametys.runtime.model.ViewItemAccessor
addViewItems, getModelViewItem, getViewItem, hasModelViewItem, hasModelViewItem, hasModelViewItem
-
Constructor Details
-
View
public View()
-
-
Method Details
-
of
- Parameters:
model
- the model- Returns:
- the created
View
- Throws:
IllegalArgumentException
- if the model isnull
-
of
- Parameters:
models
- the models- Returns:
- the created
View
- Throws:
IllegalArgumentException
- if the models collection is empty
-
of
public static View of(Model model, String... itemPaths) throws IllegalArgumentException, BadItemTypeException Creates aView
with the given items- Parameters:
model
- the model containing items definitionsitemPaths
- the paths of the items to put in the view- Returns:
- the created
View
- Throws:
IllegalArgumentException
- if the model isnull
or if an item path isnull
, empty, or is not defined in the given modelsBadItemTypeException
- if a segment in a path (but not the last) does not represent a group item
-
of
public static View of(Collection<? extends Model> models, String... itemPaths) throws IllegalArgumentException, BadItemTypeException Creates aView
with the given items- Parameters:
models
- the models containing items definitionsitemPaths
- the paths of the items to put in the view- Returns:
- the created
View
- Throws:
IllegalArgumentException
- if the models collection is empty or if an item path isnull
, empty, or is not defined in the given modelsBadItemTypeException
- if a segment in a path (but not the last) does not represent a group item
-
of
Creates aView
with the given items. If the items are in a group, the hierarchy will be kept and the corresponding containers will be created- Parameters:
modelItems
- the items to put in the view- Returns:
- the created
View
-
copyTo
Copy the current view in the given one. Its view items are not copied- Parameters:
view
- the copy
-
getName
Description copied from interface:Labelable
Get the name. -
setName
Description copied from interface:ModifiableLabelable
Set the name.- Specified by:
setName
in interfaceModifiableLabelable
- Parameters:
name
- the name.
-
getLabel
Description copied from interface:Labelable
Retrieves the label. -
setLabel
Description copied from interface:ModifiableLabelable
Set the label.- Specified by:
setLabel
in interfaceModifiableLabelable
- Parameters:
label
- the label.
-
getDescription
Description copied from interface:Labelable
Retrieves the description.- Specified by:
getDescription
in interfaceLabelable
- Returns:
- the description.
-
setDescription
Description copied from interface:ModifiableLabelable
Set the description.- Specified by:
setDescription
in interfaceModifiableLabelable
- Parameters:
description
- the description.
-
getIconGlyph
Retrieves the CSS class to use for glyph icon- Returns:
- the glyph name.
-
setIconGlyph
Set the CSS class to use for glyph icon- Parameters:
iconGlyph
- the glyph name.
-
getIconDecorator
Retrieves the CSS class to use for decorator above the main icon- Returns:
- the glyph name.
-
setIconDecorator
Set the CSS class to use for decorator above the main icon- Parameters:
iconDecorator
- the glyph name.
-
getSmallIcon
Retrieves the URL of the small icon without the context path.- Returns:
- the icon URL for the small image 16x16.
-
setSmallIcon
Set the URL of the small icon.- Parameters:
smallIcon
- the URL of the small icon, without the context path.
-
getMediumIcon
Retrieves the URL of the small icon without the context path.- Returns:
- the icon URL for the medium sized image 32x32.
-
setMediumIcon
Set the URL of the medium icon.- Parameters:
mediumIcon
- the URL of the medium icon, without the context path.
-
getLargeIcon
Retrieves the URL of the small icon without the context path.- Returns:
- the icon URL for the large image 48x48.
-
setLargeIcon
Set the URL of the large icon.- Parameters:
largeIcon
- the URL of the large icon, without the context path.
-
isInternal
Determines if the view is for internal use only- Returns:
true
if the view is for internal use only,false
otherwise
-
setInternal
Set the internal status- Parameters:
isInternal
-true
to make the view for internal use only,false
otherwise
-
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
-
toJSON
Converts the view in a JSON map- Parameters:
context
- the context of the definitions included in the view- Returns:
- The view as a JSON map
- Throws:
ProcessingException
- If an error occurs when converting the view
-
toSAX
Generates SAX events for the view- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventscontext
- the context of the definitions included in the view- Throws:
SAXException
- if an error occurs during the SAX events generation
-
includeView
Include the given view to the current one. Add the items of the view to include if they are not already present in the current view- Parameters:
viewToInclude
- the view to include
-
hashCode
-
equals
-
equals
Indicates whether some other object is "equal to" this one.- Parameters:
obj
- the reference object with which to compare.checkDetails
-true
to check the view's details during comparison (label, description, icon, ...)- Returns:
true
if this object is the same as the given obj,false
otherwise.
-