public class Navitem
extends org.zkoss.zul.impl.LabelImageElement
implements org.zkoss.zk.ui.ext.Disable
Navbar or Nav element.
It acts much like a button but it is rendered on a navbar or nav.
Default getZclass(): z-navitem.
| Constructor and Description |
|---|
Navitem() |
| Modifier and Type | Method and Description |
|---|---|
void |
beforeParentChanged(org.zkoss.zk.ui.Component parent) |
String |
getBadgeText()
Returns the badge text of the navitem
|
String |
getContent()
Returns the embedded content (i.e., HTML tags) that is
shown as part of the description.
|
String |
getHref()
Returns the href.
|
Navbar |
getNavbar()
Returns the navigation bar that it belongs to.
|
String |
getTarget()
Returns the target frame or window.
|
String |
getZclass() |
boolean |
isDisabled()
Returns whether it is disabled.
|
boolean |
isSelected()
Returns whether it is selected.
|
boolean |
isTopmost()
Returns whether this is in a top-level navbar, i.e., not owning
by another
Nav. |
protected void |
renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) |
void |
setBadgeText(String badgeText)
Sets the badge text of the navitem
|
void |
setContent(String content)
Sets the embedded content (i.e., HTML tags) that is
shown as part of the description.
|
void |
setDisabled(boolean disabled)
Sets whether it is disabled.
|
void |
setHref(String href)
Sets the href.
|
void |
setSelected(boolean selected)
Sets whether it is selected.
|
void |
setTarget(String target)
Sets the target frame or window.
|
clone, getExtraCtrl, getHoverImage, getHoverImageContent, getIconSclass, getImage, getImageContent, getPropertyAccess, getSrc, isImageAssigned, setHoverImage, setHoverImageContent, setHoverImageContent, setIconSclass, setImage, setImageContent, setImageContent, setSrcgetContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesaddSclass, evalCSSFlex, focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, service, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyaddAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, invalidatePartial, isChildable, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerializepublic String getHref()
Default: null. If null, the button has no function unless you specify the onClick handler.
public void setHref(String href) throws org.zkoss.zk.ui.WrongValueException
org.zkoss.zk.ui.WrongValueExceptionpublic String getContent()
It is useful to show the description in more versatile way.
public void setContent(String content)
It is useful to show the description in more versatile way.
Default: empty ("").
Deriving class can override it to return whatever it wants other than null.
Unlike other methods, the content assigned to this method is generated directly to the browser without escaping. Thus, it is better not to have something input by the user to avoid any XSS attach.
Note: since 9.6.6, the content is sanitized by default to avoid XSS attack, and please don't use JavaScript in the content.
public String getTarget()
Note: it is useful only if href (setHref(java.lang.String)) is specified
(i.e., use the onClick listener).
Default: null.
public void setTarget(String target)
target - the name of the frame or window to hyperlink.public Navbar getNavbar()
public boolean isSelected()
Default: false.
public void setSelected(boolean selected)
public void setDisabled(boolean disabled)
setDisabled in interface org.zkoss.zk.ui.ext.Disablepublic boolean isDisabled()
Default: false.
isDisabled in interface org.zkoss.zk.ui.ext.Disablepublic String getBadgeText()
public void setBadgeText(String badgeText)
public String getZclass()
getZclass in class org.zkoss.zk.ui.HtmlBasedComponentpublic boolean isTopmost()
Nav.public void beforeParentChanged(org.zkoss.zk.ui.Component parent)
beforeParentChanged in interface org.zkoss.zk.ui.sys.ComponentCtrlbeforeParentChanged in class org.zkoss.zk.ui.AbstractComponentprotected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
throws IOException
renderProperties in class org.zkoss.zul.impl.LabelImageElementIOExceptionCopyright © 2026. All rights reserved.