Class MenuItem
- java.lang.Object
-
- com.broadleafcommerce.menu.domain.MenuItem
-
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware
,Serializable
- Direct Known Subclasses:
NavigableMenuItem
public class MenuItem extends Object implements Serializable, com.broadleafcommerce.data.tracking.core.ContextStateAware
A domain representing a listed item in a menu tree.Each menu item must be under a named
Menu
. Its position in the menu's hierarchy is entirely determined by themenu item which is specified as its parent
.- Author:
- Samarth Dhruva (samarthd)
- See Also:
Menu
,NavigableMenuItem
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MenuItem()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState
getContextState()
A subset ofTracking
information to expose the context state for this object.String
getCustomHtml()
The HTML that should be used to display the menu item.Long
getDisplayOrder()
The order in which this item should be displayed relative to its siblings in the navigation tree.String
getId()
The context ID of the menu item.String
getImageAltText()
IfimageUrl
is set, this field should contain the alt text for that image.String
getImageUrl()
The url of the image that should be rendered (as an<img/>
) when displaying this menu item.String
getLabel()
The user-visible label for this menu item.String
getParentMenuId()
The context ID of the namedMenu
this menu item should be under.String
getParentMenuItemId()
The context ID of the menu item this menu item should be under.String
getType()
The type of menu item.String
getUrl()
The url that is visited when the menu item is clicked.int
hashCode()
void
setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
A subset ofTracking
information to expose the context state for this object.void
setCustomHtml(String customHtml)
The HTML that should be used to display the menu item.void
setDisplayOrder(Long displayOrder)
The order in which this item should be displayed relative to its siblings in the navigation tree.void
setId(String id)
The context ID of the menu item.void
setImageAltText(String imageAltText)
IfimageUrl
is set, this field should contain the alt text for that image.void
setImageUrl(String imageUrl)
The url of the image that should be rendered (as an<img/>
) when displaying this menu item.void
setLabel(String label)
The user-visible label for this menu item.void
setParentMenuId(String parentMenuId)
The context ID of the namedMenu
this menu item should be under.void
setParentMenuItemId(String parentMenuItemId)
The context ID of the menu item this menu item should be under.void
setType(String type)
The type of menu item.void
setUrl(String url)
The url that is visited when the menu item is clicked.String
toString()
-
-
-
Method Detail
-
getId
public String getId()
The context ID of the menu item.- Returns:
- the context ID of the menu item
-
getParentMenuItemId
public String getParentMenuItemId()
The context ID of the menu item this menu item should be under.This is optional, as menu items don't have to be under another menu item. If this value is not set, this menu item will be a top level menu-item in its
named menu
.If this value is set, then this menu item will appear directly under the specified menu item, however deep that parent menu item is in the overall navigation tree.
- Returns:
- (optional) the context ID of the menu item this item should appear under
-
getParentMenuId
public String getParentMenuId()
The context ID of the namedMenu
this menu item should be under.This is required for all menu items regardless of whether they are top-level or deeply nested under other items.
If the
parent menu item
is not set, then this item will appear in the first level of this specified named menu. Otherwise, it will only appear directly under that specified menu item in the tree of this menu.- Returns:
- the context ID of the named menu whose tree this item should appear in
-
getLabel
public String getLabel()
The user-visible label for this menu item.- Returns:
- the user-visible label for this menu item
-
getUrl
public String getUrl()
The url that is visited when the menu item is clicked.- Returns:
- the url that is visited when the menu item is clicked
-
getDisplayOrder
public Long getDisplayOrder()
The order in which this item should be displayed relative to its siblings in the navigation tree.- Returns:
- the order in which this item should be displayed relative to its siblings
-
getImageUrl
public String getImageUrl()
The url of the image that should be rendered (as an<img/>
) when displaying this menu item.This field is optional.
- Returns:
- (optional) url of the image that should be rendered when displaying this menu item
- See Also:
getImageAltText()
-
getImageAltText
public String getImageAltText()
IfimageUrl
is set, this field should contain the alt text for that image.- Returns:
- the alt text that should be used for the
image
(if set)
-
getCustomHtml
public String getCustomHtml()
The HTML that should be used to display the menu item.This field is optional, and is intended to enable customization of the display of the menu item.
- Returns:
- (optional) the HTML that should be used to display the menu item
-
getType
public String getType()
The type of menu item. For instance, this could be a link to a category, product, or CMS page.- Returns:
- The type of menu item.
- See Also:
MenuItemType
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
A subset ofTracking
information to expose the context state for this object.- Specified by:
getContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Returns:
- a subset of
Tracking
information to expose the context state for this object
-
setId
public void setId(String id)
The context ID of the menu item.- Parameters:
id
- the context ID of the menu item
-
setParentMenuItemId
public void setParentMenuItemId(String parentMenuItemId)
The context ID of the menu item this menu item should be under.This is optional, as menu items don't have to be under another menu item. If this value is not set, this menu item will be a top level menu-item in its
named menu
.If this value is set, then this menu item will appear directly under the specified menu item, however deep that parent menu item is in the overall navigation tree.
- Parameters:
parentMenuItemId
- (optional) the context ID of the menu item this item should appear under
-
setParentMenuId
public void setParentMenuId(String parentMenuId)
The context ID of the namedMenu
this menu item should be under.This is required for all menu items regardless of whether they are top-level or deeply nested under other items.
If the
parent menu item
is not set, then this item will appear in the first level of this specified named menu. Otherwise, it will only appear directly under that specified menu item in the tree of this menu.- Parameters:
parentMenuId
- the context ID of the named menu whose tree this item should appear in
-
setLabel
public void setLabel(String label)
The user-visible label for this menu item.- Parameters:
label
- the user-visible label for this menu item
-
setUrl
public void setUrl(String url)
The url that is visited when the menu item is clicked.- Parameters:
url
- the url that is visited when the menu item is clicked
-
setDisplayOrder
public void setDisplayOrder(Long displayOrder)
The order in which this item should be displayed relative to its siblings in the navigation tree.- Parameters:
displayOrder
- the order in which this item should be displayed relative to its siblings
-
setImageUrl
public void setImageUrl(String imageUrl)
The url of the image that should be rendered (as an<img/>
) when displaying this menu item.This field is optional.
- Parameters:
imageUrl
- (optional) url of the image that should be rendered when displaying this menu item- See Also:
getImageAltText()
-
setImageAltText
public void setImageAltText(String imageAltText)
IfimageUrl
is set, this field should contain the alt text for that image.- Parameters:
imageAltText
- the alt text that should be used for theimage
(if set)
-
setCustomHtml
public void setCustomHtml(String customHtml)
The HTML that should be used to display the menu item.This field is optional, and is intended to enable customization of the display of the menu item.
- Parameters:
customHtml
- (optional) the HTML that should be used to display the menu item
-
setType
public void setType(String type)
The type of menu item. For instance, this could be a link to a category, product, or CMS page.- Parameters:
type
- The type of menu item.- See Also:
MenuItemType
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
A subset ofTracking
information to expose the context state for this object.- Specified by:
setContextState
in interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware
- Parameters:
contextState
- a subset ofTracking
information to expose the context state for this object
-
canEqual
protected boolean canEqual(Object other)
-
-