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,ValueTypeT>,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,ValueTypeT>,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,ValueTypeT>,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>
ImmutableXulElementinterface.Support @Action
Name Action Type onCtrlKey ActionData: KeyData
Represents an action triggered by the user presses thectrlKeyson 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, theonCtrlKeyaction will be triggered to the component with an instance ofKeyData. LikeENTERandESC, you could specify the listener and thectrlKeysattribute 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 thectrlKeysattribute that matches the keystroke.
For example,
As shown, you could use@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.StringgetContext()Returns theIDof thepopupthat should appear when the user right-clicks on the element (a.k.a., context menu).java.lang.StringgetCtrlKeys()Returns what keystrokes to intercept when a user presses thekeyon the component.java.lang.StringgetPopup()Returns theIDof thepopupthat should appear when the user clicks on the component.java.lang.StringgetTooltip()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.IwithContext(java.lang.String context)Returns a copy ofthisimmutable component with the specifiedcontext.IwithCtrlKeys(java.lang.String ctrlKeys)Returns a copy ofthisimmutable component with the specifiedctrlKeys.IwithPopup(java.lang.String popup)Returns a copy ofthisimmutable component with the specifiedpopup.IwithTooltip(java.lang.String tooltip)Returns a copy ofthisimmutable 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 thekeyon the component.Default:
null.
-
withCtrlKeys
I withCtrlKeys(@Nullable java.lang.String ctrlKeys)
Returns a copy ofthisimmutable component with the specifiedctrlKeys.Sets what keystrokes to intercept.
The
stringcould be a combination of the following:Key Syntax Description Control ^[?][?]can be a~z, 0~9, #[?],e.g.
^krepresentsCtrl+kAlt @[?][?]can be a~z, 0~9, #[?],e.g.
@krepresentsAlt+kShift $[?][?]can be #[?]. Note: $a ~ $z are not supported.e.g.
$#downrepresentsShift+↓Mac command(⌘) %[?][?]can be a~z, 0~9, #[?]. e.g.%krepresentscommand+kNavigation key #[?]the supported value of [?]are listed below:Home #homeEnd #endInsert #insDelete #del← #left→ #right↑ #up↓ #downPgUp #pgupPgDn #pgdnBackspace #bakfunction key (F1, F2,... F12) #f1, #f2, ... #f12Tab #tabFor 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
thisobject
-
getContext
@Nullable java.lang.String getContext()
Returns theIDof thepopupthat 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 ofthisimmutable component with the specifiedcontext.Sets the
IDof thepopupthat should appear when the user right-clicks on the element (a.k.a., context menu).An
onOpenaction 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 theonOpenaction.The context menu can be shown by a position or the location of
xandy, you can specify the following format:
id, positionid, position=before_startid, x=15, y=20
.withContext("id, start_before")The context menu can also be shown on customized location of
xandyby 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- TheIDofIPopup- Returns:
- A modified copy of the
thisobject
-
getPopup
@Nullable java.lang.String getPopup()
Returns theIDof thepopupthat should appear when the user clicks on the component.Default:
null(no popup).
-
withPopup
I withPopup(@Nullable java.lang.String popup)
Returns a copy ofthisimmutable component with the specifiedpopup.Sets the
IDof thepopupthat should appear when the user clicks on the component.An
onOpenaction 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 theonOpenaction.The popup can be shown by a position or the location of
xandy, you can specify the following format:id, positionid, position=before_startid, x=15, y=20
.withPopup("id, start_before")The popup can also be shown on customized location of
xandyby 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- TheIDofIPopup- Returns:
- A modified copy of the
thisobject
-
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 ofthisimmutable component with the specifiedtooltip.Sets the
IDof thepopupthat should be used as a tooltip window when the mouse hovers over the component for a moment.An
onOpenaction is triggered to the tooltip if it is going to appear. Therefore, developers can manipulate it dynamically (perhaps based onOpenData.getReference()) by listening to theonOpenaction.The tooltip can be shown by a position or the location of
xandy, and can be specified with a delay time (in millisecond), you can specify the following format:
id, positionid, position=before_start, delay=500id, x=15, y=20
.withTooltip("id, start_before")The tooltip can also be shown on customized location of
xandyby 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- TheIDofIPopup- Returns:
- A modified copy of the
thisobject
-
-