Interface IAnchornav<I extends IAnyGroup>
-
- All Superinterfaces:
IAnyGroup<IAnchornav<I>>
,IChildable<IAnchornav<I>,I>
,IComponent<IAnchornav<I>>
,IHtmlBasedComponent<IAnchornav<I>>
,IXulElement<IAnchornav<I>>
public interface IAnchornav<I extends IAnyGroup> extends IXulElement<IAnchornav<I>>, IChildable<IAnchornav<I>,I>, IAnyGroup<IAnchornav<I>>
ImmutableAnchornav
componentThis 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
orButton
components can be used as links and targets are specified by theIComponent.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 Classes Modifier and Type Interface Description static class
IAnchornav.Builder<I extends IAnyGroup>
Builds instances of typeIAnchornav
.static class
IAnchornav.Updater
Builds an updater of typeIAnchornav
forUiAgent.smartUpdate(Locator, SmartUpdater)
.
-
Field Summary
Fields Modifier and Type Field Description static IAnchornav<IAnyGroup>
DEFAULT
Constant for default attributes of this immutable component.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.String
getName()
Returns the name of the component to be associated with other scrollable containers.default java.lang.String
getWidgetClass()
Returns the client widget class.default boolean
isPositionFixed()
Returns 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>of(java.lang.Iterable<? extends I> children)
Returns the instance with the given any group children.static <I extends IAnyGroup>
IAnchornav<I>ofId(java.lang.String id)
Returns the instance with the given id.IAnchornav<I>
withName(java.lang.String name)
Returns a copy ofthis
immutable component with the specifiedname
.IAnchornav<I>
withPositionFixed(boolean positionFixed)
Returns a copy ofthis
immutable component with the specifiedpositionFixed
.-
Methods inherited from interface org.zkoss.stateless.sul.IChildable
getChildren, withChildren, withChildren
-
Methods 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, withWidgetOverrides
-
Methods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndex
-
Methods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
-
-
-
Field Detail
-
DEFAULT
static final IAnchornav<IAnyGroup> DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Detail
-
getWidgetClass
default java.lang.String getWidgetClass()
Returns the client widget class.Default:
"zkmax.nav.Anchornav"
- Specified by:
getWidgetClass
in interfaceIComponent<I extends IAnyGroup>
-
getName
default java.lang.String getName()
Returns the name of the component to be associated with other scrollable containers.Default:
""
(empty)
-
withName
IAnchornav<I> withName(java.lang.String name)
Returns a copy ofthis
immutable 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
this
object
-
isPositionFixed
default boolean isPositionFixed()
Returns whether it would be fixed position when out of current viewport.Default:
true
-
withPositionFixed
IAnchornav<I> withPositionFixed(boolean positionFixed)
Returns a copy ofthis
immutable 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
this
object
-
of
static <I extends IAnyGroup> IAnchornav<I> of(java.lang.Iterable<? extends I> children)
Returns the instance with the given any group children.- Parameters:
children
- The children belong to any group- See Also:
IAnyGroup
-
of
static <I extends IAnyGroup> IAnchornav<I> of(I... children)
Returns the instance with the given any group children.- Parameters:
children
- The children belong to any group- See Also:
IAnyGroup
-
ofId
static <I extends IAnyGroup> IAnchornav<I> ofId(java.lang.String id)
Returns the instance with the given id.- Parameters:
id
- The id to identify this component
-
-