Interface IXulElement<I extends IXulElement>
-
- All Superinterfaces:
IComponent<I>
,IHtmlBasedComponent<I>
- All Known Subinterfaces:
IA<I>
,IAbsolutechildren<I>
,IAbsolutelayout
,IAnchornav<I>
,IAudio
,IAuxhead
,IAuxheader<I>
,IBandbox
,IBandpopup<I>
,IBarcode
,IBarcodescanner
,IBiglistbox
,IButton
,IButtonBase<I>
,ICalendar
,ICamera
,ICaption<I>
,ICardlayout<I>
,ICell<I>
,ICenter<I>
,ICheckbox
,ICheckboxBase<I>
,ICoachmark<I>
,IColorbox
,IColumn<I>
,IColumnchildren<I>
,IColumnlayout
,IColumns
,ICombobox
,ICombobutton
,IComboitem
,IDatebox
,IDateTimeFormatInputElement<I>
,IDecimalbox
,IDetail<I>
,IDetailChild<I>
,IDiv<I>
,IDoublebox
,IDoublespinner
,IDrawer<I>
,IDropupload
,IEast<I>
,IFileupload
,IFisheye
,IFisheyebar
,IFoot
,IFooter<I>
,IFooterElement<I>
,IFormatInputElement<I,ValueType>
,IFrozen<I>
,IGoldenLayout
,IGoldenPanel<I>
,IGrid
,IGroup<I>
,IGroupbox<I>
,IGroupChild<I>
,IGroupfoot<I>
,IGroupfootChild<I>
,IHeaderElement<I>
,IHeadersElement<I>
,IHlayout<I>
,IHtml
,IImage
,IImageBase<I>
,IImagemap
,IInputElement<I,ValueType>
,IInputgroup
,IIntbox
,ILabel
,ILabelElement<I>
,ILabelImageElement<I>
,ILayout<I>
,ILayoutRegion<I>
,ILineitem<I>
,ILinelayout
,IListbox
,IListcell<I>
,IListfoot
,IListfooter<I>
,IListgroup
,IListgroupChild<I>
,IListgroupfoot
,IListgroupfootChild<I>
,IListhead
,IListheader<I>
,IListitem
,IListitemBase<I>
,ILongbox
,IMenu
,IMenubar
,IMenuitem
,IMenupopup
,IMenuseparator
,IMeshElement<I>
,IMultislider
,INav
,INavbar
,INavitem
,INavseparator
,INorth<I>
,INumberInputElement<I,ValueType>
,IOrganigram
,IOrgchildren
,IOrgitem
,IOrgnode<I>
,IPaging
,IPanel
,IPanelchildren<I>
,IPdfviewer
,IPopup<I>
,IPopupBase<I>
,IPortalchildren
,IPortallayout
,IProgressmeter
,IRadio
,IRadiogroup<I>
,IRangeslider
,IRangesliderBase<I>
,IRow<I>
,IRowBase<I>
,IRowchildren<I>
,IRowlayout
,IRows
,IScrollview<I>
,ISeparator
,ISeparatorBase<I>
,ISignature
,ISlider
,ISliderbuttons
,ISouth<I>
,ISpace
,ISpan<I>
,ISpinner
,ISplitlayout<I>
,IStep
,IStepbar
,ITab
,ITabbox
,ITablechildren<I>
,ITablelayout
,ITabpanel<I>
,ITabpanels
,ITabs
,ITbeditor
,ITextbox
,ITextboxBase<I>
,ITimebox
,ITimepicker
,IToolbar<I>
,IToolbarbutton
,ITrack
,ITree
,ITreecell<I>
,ITreechildren
,ITreecol<I>
,ITreecols
,ITreefoot
,ITreefooter<I>
,ITreeitem
,ITreerow
,IVideo
,IVlayout<I>
,IWest<I>
,IWindow<I>
public interface IXulElement<I extends IXulElement> extends IHtmlBasedComponent<I>
ImmutableXulElement
interface.Support @Action
Name Action Type onCtrlKey ActionData: KeyData
Represents an action triggered by the user presses thectrlKeys
on a component.Keystroke Handling
To handle the control keys, you have to specify the keystrokes you want to handle with
withCtrlKeys(String)
. Then, if any child component gains the focus and the user presses a keystroke matches the combination, theonCtrlKey
action will be triggered to the component with an instance ofKeyData
. LikeENTER
andESC
, you could specify the listener and thectrlKeys
attribute in one of the ancestors. ZK will search the component having the focus, its parent, its parent's parent and so on to find if any of them specifies thectrlKeys
attribute that matches the keystroke.
For example,@
RichletMapping
("/keystrokeHandling") public IComponent keystrokeHandling() { return IVlayout.of(ITextbox.DEFAULT, IDatebox.DEFAULT) .withCtrlKeys("@c^a#f10^#f3").withAction(this::doKeystrokeHandling); } @Action
(type = Events.ON_CTRL_KEY) public void doKeystrokeHandling(KeyData data) { Clients.log(data.getKeyCode()); }KeyData.getKeyCode()
to know which key was pressed.- Author:
- jumperchen
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getContext()
Returns theID
of thepopup
that should appear when the user right-clicks on the element (a.k.a., context menu).java.lang.String
getCtrlKeys()
Returns what keystrokes to intercept when a user presses thekey
on the component.java.lang.String
getPopup()
Returns theID
of thepopup
that should appear when the user clicks on the component.java.lang.String
getTooltip()
Returns the ID of the popup (IPopup
) that should be used as a tooltip window when the mouse hovers over the component for a moment.I
withContext(java.lang.String context)
Returns a copy ofthis
immutable component with the specifiedcontext
.I
withCtrlKeys(java.lang.String ctrlKeys)
Returns a copy ofthis
immutable component with the specifiedctrlKeys
.I
withPopup(java.lang.String popup)
Returns a copy ofthis
immutable component with the specifiedpopup
.I
withTooltip(java.lang.String tooltip)
Returns a copy ofthis
immutable component with the specifiedtooltip
.-
Methods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetClass, 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
-
-
-
-
Method Detail
-
getCtrlKeys
@Nullable java.lang.String getCtrlKeys()
Returns what keystrokes to intercept when a user presses thekey
on the component.Default:
null
.
-
withCtrlKeys
I withCtrlKeys(@Nullable java.lang.String ctrlKeys)
Returns a copy ofthis
immutable component with the specifiedctrlKeys
.Sets what keystrokes to intercept.
The
string
could be a combination of the following:Key Syntax Description Control ^[?]
[?]
can be a~z, 0~9, #[?],e.g.
^k
representsCtrl+k
Alt @[?]
[?]
can be a~z, 0~9, #[?],e.g.
@k
representsAlt+k
Shift $[?]
[?]
can be #[?]. Note: $a ~ $z are not supported.e.g.
$#down
representsShift+↓
Mac command(⌘) %[?]
[?]
can be a~z, 0~9, #[?]. e.g.%k
representscommand+k
Navigation key #[?]
the supported value of [?]
are listed below:Home #home
End #end
Insert #ins
Delete #del
← #left
→ #right
↑ #up
↓ #down
PgUp #pgup
PgDn #pgdn
Backspace #bak
function key (F1, F2,... F12) #f1, #f2, ... #f12
Tab #tab
For example,
^a^d@c#f10#left#right
- It means you want to intercept Ctrl+A, Ctrl+D, Alt+C, F10, Left and Right.
^#left
- It means Ctrl+Left.
^#f1
- It means Ctrl+F1.
@#f3
- It means Alt+F3.
Note: it doesn't support Ctrl+Alt, Shift+Ctrl, Shift+Alt or Shift+Ctrl+Alt.
- Parameters:
ctrlKeys
- The expression of the keystroke combination to intercept with.- Returns:
- A modified copy of the
this
object
-
getContext
@Nullable java.lang.String getContext()
Returns theID
of thepopup
that should appear when the user right-clicks on the element (a.k.a., context menu).Default:
null
(no context menu).
-
withContext
I withContext(@Nullable java.lang.String context)
Returns a copy ofthis
immutable component with the specifiedcontext
.Sets the
ID
of thepopup
that should appear when the user right-clicks on the element (a.k.a., context menu).An
onOpen
action is triggered to the context menu if it is going to appear. Therefore, developers can manipulate it dynamically (perhaps based onOpenData.getReference()
) by listening to theonOpen
action.The context menu can be shown by a position or the location of
x
andy
, you can specify the following format:
id, position
id, position=before_start
id, x=15, y=20
.withContext("id, start_before")
The context menu can also be shown on customized location of
x
andy
by adding parentheses"()"
, for example,.withContext("id, x=(zk.currentPointer[0] + 10), y=(zk.currentPointer[1] - 10)")
Possible values for the position attribute are:
- before_start
the popup appears above the anchor, aligned to the left. - before_center
the popup appears above the anchor, aligned to the center. - before_end
the popup appears above the anchor, aligned to the right. - after_start
the popup appears below the anchor, aligned to the left. - after_center
the popup appears below the anchor, aligned to the center. - after_end
the popup appears below the anchor, aligned to the right. - start_before
the popup appears to the left of the anchor, aligned to the top. - start_center
the popup appears to the left of the anchor, aligned to the middle. - start_after
the popup appears to the left of the anchor, aligned to the bottom. - end_before
the popup appears to the right of the anchor, aligned to the top. - end_center
the popup appears to the right of the anchor, aligned to the middle. - end_after
the popup appears to the right of the anchor, aligned to the bottom. - overlap/top_left
the popup overlaps the anchor, with anchor and popup aligned at top-left. - top_center
the popup overlaps the anchor, with anchor and popup aligned at top-center. - overlap_end/top_right
the popup overlaps the anchor, with anchor and popup aligned at top-right. - middle_left
the popup overlaps the anchor, with anchor and popup aligned at middle-left. - middle_center
the popup overlaps the anchor, with anchor and popup aligned at middle-center. - middle_right
the popup overlaps the anchor, with anchor and popup aligned at middle-right. - overlap_before/bottom_left
the popup overlaps the anchor, with anchor and popup aligned at bottom-left. - bottom_center
the popup overlaps the anchor, with anchor and popup aligned at bottom-center. - overlap_after/bottom_right
the popup overlaps the anchor, with anchor and popup aligned at bottom-right. - at_pointer
the popup appears with the upper-left aligned with the mouse cursor. - after_pointer
the popup appears with the top aligned with the bottom of the mouse cursor, with the left side of the popup at the horizontal position of the mouse cursor.
- Parameters:
context
- TheID
ofIPopup
- Returns:
- A modified copy of the
this
object
-
getPopup
@Nullable java.lang.String getPopup()
Returns theID
of thepopup
that should appear when the user clicks on the component.Default:
null
(no popup).
-
withPopup
I withPopup(@Nullable java.lang.String popup)
Returns a copy ofthis
immutable component with the specifiedpopup
.Sets the
ID
of thepopup
that should appear when the user clicks on the component.An
onOpen
action is triggered to the popup menu if it is going to appear. Therefore, developers can manipulate it dynamically (perhaps based onOpenData.getReference()
) by listening to theonOpen
action.The popup can be shown by a position or the location of
x
andy
, you can specify the following format:id, position
id, position=before_start
id, x=15, y=20
.withPopup("id, start_before")
The popup can also be shown on customized location of
x
andy
by adding parentheses"()"
, for example,.withPopup("id, x=(zk.currentPointer[0] + 10), y=(zk.currentPointer[1] - 10)")
Possible values for the position attribute are:
- before_start
the popup appears above the anchor, aligned to the left. - before_center
the popup appears above the anchor, aligned to the center. - before_end
the popup appears above the anchor, aligned to the right. - after_start
the popup appears below the anchor, aligned to the left. - after_center
the popup appears below the anchor, aligned to the center. - after_end
the popup appears below the anchor, aligned to the right. - start_before
the popup appears to the left of the anchor, aligned to the top. - start_center
the popup appears to the left of the anchor, aligned to the middle. - start_after
the popup appears to the left of the anchor, aligned to the bottom. - end_before
the popup appears to the right of the anchor, aligned to the top. - end_center
the popup appears to the right of the anchor, aligned to the middle. - end_after
the popup appears to the right of the anchor, aligned to the bottom. - overlap/top_left
the popup overlaps the anchor, with anchor and popup aligned at top-left. - top_center
the popup overlaps the anchor, with anchor and popup aligned at top-center. - overlap_end/top_right
the popup overlaps the anchor, with anchor and popup aligned at top-right. - middle_left
the popup overlaps the anchor, with anchor and popup aligned at middle-left. - middle_center
the popup overlaps the anchor, with anchor and popup aligned at middle-center. - middle_right
the popup overlaps the anchor, with anchor and popup aligned at middle-right. - overlap_before/bottom_left
the popup overlaps the anchor, with anchor and popup aligned at bottom-left. - bottom_center
the popup overlaps the anchor, with anchor and popup aligned at bottom-center. - overlap_after/bottom_right
the popup overlaps the anchor, with anchor and popup aligned at bottom-right. - at_pointer
the popup appears with the upper-left aligned with the mouse cursor. - after_pointer
the popup appears with the top aligned with the bottom of the mouse cursor, with the left side of the popup at the horizontal position of the mouse cursor.
- Parameters:
popup
- TheID
ofIPopup
- Returns:
- A modified copy of the
this
object
-
getTooltip
@Nullable java.lang.String getTooltip()
Returns the ID of the popup (IPopup
) that should be used as a tooltip window when the mouse hovers over the component for a moment. The tooltip will automatically disappear when the mouse is moved away.Default:
null
(no tooltip).
-
withTooltip
I withTooltip(@Nullable java.lang.String tooltip)
Returns a copy ofthis
immutable component with the specifiedtooltip
.Sets the
ID
of thepopup
that should be used as a tooltip window when the mouse hovers over the component for a moment.An
onOpen
action is triggered to the tooltip if it is going to appear. Therefore, developers can manipulate it dynamically (perhaps based onOpenData.getReference()
) by listening to theonOpen
action.The tooltip can be shown by a position or the location of
x
andy
, and can be specified with a delay time (in millisecond), you can specify the following format:
id, position
id, position=before_start, delay=500
id, x=15, y=20
.withTooltip("id, start_before")
The tooltip can also be shown on customized location of
x
andy
by adding parentheses"()"
, for example,.withTooltip("id, x=(zk.currentPointer[0] + 10), y=(zk.currentPointer[1] - 10)")
Possible values for the position attribute are:
- before_start
the popup appears above the anchor, aligned to the left. - before_center
the popup appears above the anchor, aligned to the center. - before_end
the popup appears above the anchor, aligned to the right. - after_start
the popup appears below the anchor, aligned to the left. - after_center
the popup appears below the anchor, aligned to the center. - after_end
the popup appears below the anchor, aligned to the right. - start_before
the popup appears to the left of the anchor, aligned to the top. - start_center
the popup appears to the left of the anchor, aligned to the middle. - start_after
the popup appears to the left of the anchor, aligned to the bottom. - end_before
the popup appears to the right of the anchor, aligned to the top. - end_center
the popup appears to the right of the anchor, aligned to the middle. - end_after
the popup appears to the right of the anchor, aligned to the bottom. - overlap/top_left
the popup overlaps the anchor, with anchor and popup aligned at top-left. - top_center
the popup overlaps the anchor, with anchor and popup aligned at top-center. - overlap_end/top_right
the popup overlaps the anchor, with anchor and popup aligned at top-right. - middle_left
the popup overlaps the anchor, with anchor and popup aligned at middle-left. - middle_center
the popup overlaps the anchor, with anchor and popup aligned at middle-center. - middle_right
the popup overlaps the anchor, with anchor and popup aligned at middle-right. - overlap_before/bottom_left
the popup overlaps the anchor, with anchor and popup aligned at bottom-left. - bottom_center
the popup overlaps the anchor, with anchor and popup aligned at bottom-center. - overlap_after/bottom_right
the popup overlaps the anchor, with anchor and popup aligned at bottom-right. - at_pointer
the popup appears with the upper-left aligned with the mouse cursor. - after_pointer
the popup appears with the top aligned with the bottom of the mouse cursor, with the left side of the popup at the horizontal position of the mouse cursor.
- Parameters:
tooltip
- TheID
ofIPopup
- Returns:
- A modified copy of the
this
object
-
-