Interface IAnchornav<I extends IAnyGroup>
- All Superinterfaces:
IAnyGroup<IAnchornav<I>>,IChildable<IAnchornav<I>,,I> IComponent<IAnchornav<I>>,IHtmlBasedComponent<IAnchornav<I>>,IXulElement<IAnchornav<I>>
Anchornav component
This component synchronizes the scrolling position on a page or within ZK containers (Div, Window, etc.) with hyperlinks and buttons. It allows you to both navigate to desired ZK components in a page and to highlight the current navigation link based on the current scroll position.
Example
@RichletMapping("/example")
public IComponent example() {
return IHlayout.of(IAnchornav.of(IListbox.of(
IListitem.of(IListcell.of(IA.of("First Window").withClientAttribute("data-anchornav-target", "$win1"))),
IListitem.of(IListcell.of(IA.of("Second Window").withClientAttribute("data-anchornav-target", "$win2")))
)).withName("a1").withWidth("250px"),
IDiv.of(
IWindow.ofId("win1").withHeight("700px").withBorder(IWindow.Border.NORMAL)
.withTitle("1. First Window").withChildren(ILabel.of("Hello world.")),
IWindow.ofId("win2").withHeight("700px").withBorder(IWindow.Border.NORMAL)
.withTitle("2. Second Window").withChildren(ILabel.of("Welcome to ZK world."))
).withWidth("750px"));
}
By default, the Anchornav component will watch the scroll position of a page.
Other scrollable containers can be associated with a named Anchornav by setting the
"client-attribute" with .withClientAttribute("data-anchornav-scroll", "NAME").
For example,
IDiv.of("... other components ...").withClientAttribute("data-anchornav-scroll", "a1");
Anchor or Button components can be used as links
and targets are specified by the IComponent.withClientAttribute(String, String)
("data-anchornav-target", [selector]).
Here the JQuery-based selector syntax (#domId / .class / elementName) is extended
by ZK specific selectors using $componentId or @componentName.
- Author:
- katherine
- See Also:
-
Anchornav
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classIAnchornav.Builder<I extends IAnyGroup>Builds instances of typeIAnchornav.static classBuilds an updater of typeIAnchornavforUiAgent.smartUpdate(Locator, SmartUpdater). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IAnchornav<IAnyGroup>Constant for default attributes of this immutable component. -
Method Summary
Modifier and TypeMethodDescriptiondefault StringgetName()Returns the name of the component to be associated with other scrollable containers.default StringReturns the client widget class.default booleanReturns whether it would be fixed position when out of current viewport.static <I extends IAnyGroup>
IAnchornav<I>of(I... children) Returns the instance with the given any group children.static <I extends IAnyGroup>
IAnchornav<I>Returns the instance with the given any group children.static <I extends IAnyGroup>
IAnchornav<I>Returns the instance with the given id.Returns a copy ofthisimmutable component with the specifiedname.withPositionFixed(boolean positionFixed) Returns a copy ofthisimmutable component with the specifiedpositionFixed.Methods inherited from interface org.zkoss.stateless.sul.IChildable
getChildren, withChildren, withChildrenMethods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverridesMethods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withSkeleton, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndexMethods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
Field Details
-
DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Details
-
getWidgetClass
Returns the client widget class.Default:
"zkmax.nav.Anchornav"- Specified by:
getWidgetClassin interfaceIComponent<I extends IAnyGroup>
-
getName
Returns the name of the component to be associated with other scrollable containers.Default:
""(empty) -
withName
Returns a copy ofthisimmutable component with the specifiedname.Sets the name of the component to be associated with other scrollable containers.
- Parameters:
name- The name of the component to be associated with other scrollable containers.Default:
""(empty).- Returns:
- A modified copy of the
thisobject
-
isPositionFixed
default boolean isPositionFixed()Returns whether it would be fixed position when out of current viewport.Default:
true -
withPositionFixed
Returns a copy ofthisimmutable component with the specifiedpositionFixed.Sets whether it would be fixed position when out of current viewport.
- Parameters:
positionFixed- Whether it would be fixed position when out of current viewport.Default:
true.- Returns:
- A modified copy of the
thisobject
-
of
Returns the instance with the given any group children.- Parameters:
children- The children belong to any group- See Also:
-
of
Returns the instance with the given any group children.- Parameters:
children- The children belong to any group- See Also:
-
ofId
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-