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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddViewItem(ViewItem item) Add a view item in the accessorvoidclear()Removes all items of this accessorvoidCopy the current view in the given one.booleanbooleanIndicates 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 accessorinthashCode()voidincludeView(View viewToInclude) Include the given view to the current one.voidinsertViewItem(ViewItem item, int index) Insert a view item in the accessor at the given indexbooleanDetermines if the view is for internal use onlystatic Viewof(Collection<? extends Model> models) static Viewof(Collection<? extends Model> models, String... itemPaths) Creates aViewwith the given itemsstatic Viewstatic ViewCreates aViewwith the given items.static ViewCreates aViewwith the given itemsbooleanremoveViewItem(ViewItem item) Removes the given items of this accessorvoidsetDescription(I18nizableText description) Set the description.voidsetIconDecorator(String iconDecorator) Set the CSS class to use for decorator above the main iconvoidsetIconGlyph(String iconGlyph) Set the CSS class to use for glyph iconvoidsetInternal(boolean isInternal) Set the internal statusvoidsetLabel(I18nizableText label) Set the label.voidsetLargeIcon(String largeIcon) Set the URL of the large icon.voidsetMediumIcon(String mediumIcon) Set the URL of the medium icon.voidSet the name.voidsetSmallIcon(String smallIcon) Set the URL of the small icon.toJSON(DefinitionContext context) Converts the view in a JSON mapvoidtoSAX(ContentHandler contentHandler, DefinitionContext context) Generates SAX events for the viewMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods 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 aViewwith 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 isnullor 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 aViewwith 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 aViewwith 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:LabelableGet the name. -
setName
Description copied from interface:ModifiableLabelableSet the name.- Specified by:
setNamein interfaceModifiableLabelable- Parameters:
name- the name.
-
getLabel
Description copied from interface:LabelableRetrieves the label. -
setLabel
Description copied from interface:ModifiableLabelableSet the label.- Specified by:
setLabelin interfaceModifiableLabelable- Parameters:
label- the label.
-
getDescription
Description copied from interface:LabelableRetrieves the description.- Specified by:
getDescriptionin interfaceLabelable- Returns:
- the description.
-
setDescription
Description copied from interface:ModifiableLabelableSet the description.- Specified by:
setDescriptionin 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:
trueif the view is for internal use only,falseotherwise
-
setInternal
Set the internal status- Parameters:
isInternal-trueto make the view for internal use only,falseotherwise
-
getViewItems
Description copied from interface:ViewItemAccessorRetrieves all the view items of this accessor- Specified by:
getViewItemsin interfaceViewItemAccessor- Returns:
- the view items
-
addViewItem
Description copied from interface:ViewItemAccessorAdd a view item in the accessor- Specified by:
addViewItemin interfaceViewItemAccessor- Parameters:
item- the item to add
-
insertViewItem
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
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
Description copied from interface:ViewItemAccessorRemoves all items of this accessor- Specified by:
clearin 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- theContentHandlerthat 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-trueto check the view's details during comparison (label, description, icon, ...)- Returns:
trueif this object is the same as the given obj,falseotherwise.
-