new Alert(properties)
消息框组件;在页面中心弹出对话框,增加了直接设置内容文本的功能,并且可以通过限制文本宽度实现高度自适应
样式属性(不含从父类继承):contentText, contentPadding, contentIcon, contentTextColor, contentTextFont, fixedWith
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
properties |
Object |
<optional> |
Extends
Methods
-
a(property, value) → {any}
-
Parameters:
Name Type Attributes Description property
any value
any <optional>
Returns:
any- Inherited From:
-
addButton(button, index) → {void}
-
增加底栏按钮
Parameters:
Name Type Attributes Description button
any 按钮配置 json
index
number <optional>
显示顺序
Returns:
void- Inherited From:
-
addPropertyChangeListener(listener, scope, ahead) → {void}
-
增加属性事件变化监听函数
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
ahead
boolean <optional>
是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
addStyleProperty(property) → {void}
-
追加样式属性,将参数属性加入到样式属性列表中
Parameters:
Name Type Description property
string 属性名
Returns:
void- Inherited From:
-
addToDOM(dom, rect) → {void}
-
将组件加到页面的 DOM 树中;如果没有任何参数,或者只指定第一个参数并且第一个参数为 window,则组件会填满整个浏览器窗口,
并且浏览器窗口大小变化时也会自动刷新组件Parameters:
Name Type Attributes Description dom
HTMLElement <optional>
指定组件的父亲 DOM,如果为空,则加到 body 中
rect
Object <optional>
组件的范围,格式为 {x: x, y: y, width: width, height: height};如果为空,则填满父亲 DOM
Returns:
void- Inherited From:
-
addTool(tool, index) → {void}
-
增加工具按钮
Parameters:
Name Type Attributes Description tool
any 工具按钮配置 json
index
number <optional>
显示顺序
Returns:
void- Inherited From:
-
addView(view, params, index) → {void}
-
将子组件加到容器中
Parameters:
Name Type Attributes Description view
ht.ui.View | ht.ui.TableRow 子组件
params
any <optional>
布局参数;可通过 childView.setLayoutPrams({...}) 提前设置并省略此参数
index
number <optional>
在子组件列表中的插入位置
Returns:
void- Inherited From:
-
addViewListener(listener, scope, ahead) → {void}
-
增加 View 事件监听器,如 invalidate(无效事件)、beginValidate 等事件
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
监听器函数域
ahead
boolean <optional>
是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
adjustChildHeight(child, height) → {number}
-
布局器计算出子组件的高度,传入此函数进行验证,确保其不会大于 maxSize.height 或小于 minSize.height
返回值会被用于布局子组件Parameters:
Name Type Description child
ht.ui.View 子组件
height
number 验证之前的高度
Returns:
number -验证之后的高度
- Inherited From:
-
adjustChildWidth(child, width) → {number}
-
布局器计算出子组件的宽度,传入此函数进行验证,确保其不会大于 maxSize.width 或小于 minSize.width;
返回值会被用于布局子组件Parameters:
Name Type Description child
ht.ui.View 子组件
width
number 验证之前的宽度
Returns:
number -验证之后的宽度
- Inherited From:
-
adjustTranslateX(value) → {number}
-
调用 setTranslateX 之前调用此函数确保滚动值是合理范围内,如果滚动值不合理,将会被调整并返回
Parameters:
Name Type Description value
number 调整之前的滚动值
Returns:
number -调整后的滚动值
- Inherited From:
-
adjustTranslateY(value) → {number}
-
调用 setTranslateY 之前调用此函数确保滚动值是合理范围内,如果滚动值不合理,将会被调整并返回
Parameters:
Name Type Description value
number 调整之前的滚动值
Returns:
number -调整后的滚动值
- Inherited From:
-
checkPreferredSize(property) → {void}
-
Parameters:
Name Type Description property
string Returns:
void- Inherited From:
-
clear() → {void}
-
删除所有子组件
Returns:
void- Inherited From:
-
containsEvent(e) → {boolean}
-
判断交互事件对象位置是否在组件区域
Parameters:
Name Type Description e
UIEvent Returns:
boolean- Inherited From:
-
disableToolTip() → {void}
-
禁用工具提示,同 setToolTipEnabled
Returns:
void- Inherited From:
-
drawBackground(background, x, y, width, height, dom) → {void}
-
绘制背景
Parameters:
Name Type Attributes Description background
ht.ui.drawable.Drawable <optional>
背景 Drawable
x
number <optional>
起点 x 坐标
y
number <optional>
起点 y 坐标
width
number <optional>
宽度
height
number <optional>
高度
dom
HTMLElement <optional>
指定绘制的目标 DOM
Returns:
void- Inherited From:
-
drawBorder(border, x, y, width, height, dom) → {void}
-
绘制边框
Parameters:
Name Type Attributes Description border
ht.ui.border.Border <optional>
边框对象
x
number <optional>
起点 x 坐标
y
number <optional>
起点 y 坐标
width
number <optional>
宽度
height
number <optional>
高度
dom
HTMLElement <optional>
指定绘制的目标 DOM
Returns:
void- Inherited From:
-
drawFooterBackground(drawable, x, y, width, height) → {void}
-
绘制底栏背景
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标 Drawable 对象
x
number 绘制范围的 x 坐标
y
number 绘制范围的 y 坐标
width
number 绘制范围的宽度
height
number 绘制范围的高度
Returns:
void- Inherited From:
-
drawHeaderBackground(drawable, x, y, width, height) → {void}
-
绘制标题栏背景
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标 Drawable 对象
x
number 绘制范围的 x 坐标
y
number 绘制范围的 y 坐标
width
number 绘制范围的宽度
height
number 绘制范围的高度
Returns:
void- Inherited From:
-
drawIcon(drawable, x, y, width, height) → {void}
-
绘制标题栏图标
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标 Drawable 对象
x
number 绘制范围的 x 坐标
y
number 绘制范围的 y 坐标
width
number 绘制范围的宽度
height
number 绘制范围的高度
Returns:
void- Inherited From:
-
drawTitle(g, text, font, color, x, y, width, height) → {void}
-
绘制标题栏文字
Parameters:
Name Type Description g
CanvasRenderingContext2D 画笔对象
text
string 文字内容
font
string 文字字体
color
string 文字颜色
x
number 绘制范围的 x 坐标
y
number 绘制范围的 y 坐标
width
number 绘制范围的宽度
height
number 绘制范围的高度
Returns:
void- Inherited From:
-
drawTool(tool, toolIndex, x, y, width, height) → {void}
-
绘制工具按钮
Parameters:
Name Type Description tool
any 按钮配置 json
toolIndex
number 按钮顺序
x
number 绘制范围的 x 坐标
y
number 绘制范围的 y 坐标
width
number 绘制范围的宽度
height
number 绘制范围的高度
Returns:
void- Inherited From:
-
enableToolTip() → {void}
-
启用工具提示,同 setToolTipEnabled
Returns:
void- Inherited From:
-
figureMaxSize() → {Object}
-
计算 maxSize,maxSize 表示组件的最大尺寸,布局器布局时会考虑此尺寸;
Returns:
Object -maxSize
- Inherited From:
-
figureMinSize() → {Object}
-
计算 minSize,minSize 表示组件的最小尺寸,布局器布局时会考虑此尺寸;
Returns:
Object -minSize
- Inherited From:
-
figurePreferredSize() → {Object}
-
计算 preferredSize,preferredSize 表示组件自身最合适的尺寸,布局器布局时会考虑此尺寸;
如果自定义组件一般需要重写此函数Returns:
Object -preferredSize
- Inherited From:
-
findViewById(id, recursive, skip) → {ht.ui.View}
-
遍历子组件列表根据 id 查找匹配的子组件
Parameters:
Name Type Attributes Description id
string | number 子组件 id
recursive
boolean <optional>
是否递归查找
skip
boolean <optional>
是否跳过 refviewgroup
- Inherited From:
-
fireViewEvent(event) → {void}
-
派发 View 事件
Parameters:
Name Type Description event
string | Object 事件对象;如果是字符串,表示事件类型,函数内自动组装一个事件对象并派发示例:view.fireViewEvent('myevent') 等同于 view.fireViewEvent({kind: 'myevent'})
Returns:
void- Inherited From:
-
fp(property, oldValue, newValue, compareFunc) → {boolean}
-
派发属性变化事件,firePropertyChange 的缩写
Parameters:
Name Type Attributes Description property
string 属性名
oldValue
any 属性变化之前的值
newValue
any 属性变化之后的值
compareFunc
Object <optional>
比较函数,用于比较新值和旧值是否一致,如果一致则不会派发事件
Returns:
boolean -事件是否派发成功
- Inherited From:
-
getActiveCloseIcon() → {any}
-
获取 Active 状态下关闭图标,可以是颜色或者图片等
Returns:
any -关闭图标
- Inherited From:
-
getActiveCloseIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 Active 状态下关闭图标的 Drawable 对象
- Inherited From:
-
getActiveCollapseIcon() → {any}
-
获取 Active 状态下合并图标,可以是颜色或者图片等
Returns:
any -合并图标
- Inherited From:
-
getActiveCollapseIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 Active 状态下合并图标的 Drawable 对象
- Inherited From:
-
getActiveExpandIcon() → {any}
-
获取 Active 状态下展开图标,可以是颜色或者图片等
Returns:
any -展开图标
- Inherited From:
-
getActiveExpandIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 Active 状态下展开图标的 Drawable 对象
- Inherited From:
-
getActiveHeaderBackground() → {any}
-
获取 Active 状态下标题栏背景,可以是颜色或者图片等
Returns:
any -标题栏背景
- Inherited From:
-
getActiveHeaderBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取 Active 状态下标题栏背景的 Drawable 对象
- Inherited From:
-
getActiveMaximizeIcon() → {any}
-
获取 Active 状态下最大化图标,可以是颜色或者图片等
Returns:
any -最大化图标
- Inherited From:
-
getActiveMaximizeIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 Active 状态下最大化图标的 Drawable 对象
- Inherited From:
-
getActiveRestoreIcon() → {any}
-
获取 Active 状态下恢复图标,可以是颜色或者图片等
Returns:
any -恢复图标
- Inherited From:
-
getActiveRestoreIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 Active 状态下恢复图标的 Drawable 对象
- Inherited From:
-
getActiveTitleColor() → {string}
-
获取 Active 状态下标题文本颜色
Returns:
string -颜色值
- Inherited From:
-
getAttr(property) → {any}
-
Parameters:
Name Type Description property
string Returns:
any- Inherited From:
-
getBackground() → {any}
-
获取组件的背景,可以是颜色或者图片等
Returns:
any -组件背景
- Inherited From:
-
getBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取组件背景的 Drawable 对象
- Inherited From:
-
getBorder() → {ht.ui.border.Border}
-
获取组件的边框
- Inherited From:
-
getBorderBottom() → {number}
-
获取组件边框的底部高度
Returns:
number -组件边框底部高度
- Inherited From:
-
getBorderLeft() → {number}
-
获取组件边框的左侧宽度
Returns:
number -组件边框左侧宽度
- Inherited From:
-
getBorderRadius() → {number|Array.<number>}
-
获取 CSS 边框圆角
Returns:
number | Array.<number> -边框圆角
- Inherited From:
-
getBorderRight() → {number}
-
获取组件边框的右侧宽度
Returns:
number -组件边框右侧宽度
- Inherited From:
-
getBorderTop() → {number}
-
获取组件边框的顶部高度
Returns:
number -组件边框顶部高度
- Inherited From:
-
getBoxShadow() → {string}
-
获取 CSS 阴影值
Returns:
string -阴影值
- Inherited From:
-
getButtonAlign() → {string}
-
获取底栏按钮的水平对齐方式
Returns:
string -对齐方式,值可能为:'left'|'center'|'right'
- Inherited From:
-
getButtonGap() → {number}
-
获取底栏按钮之间的距离
Returns:
number -间距值
- Inherited From:
-
getButtonHeight(button) → {number}
-
获取底栏按钮的高度,默认返回 preferredSize.height,可重写自定义
Parameters:
Name Type Description button
ht.ui.Button 按钮对象
Returns:
number -高度值
- Inherited From:
-
getButtonPrefHeight() → {number}
-
获取对话框底部按钮的首选高度
Returns:
number- Inherited From:
-
getButtonPrefWidth() → {number}
-
获取对话框底部按钮的首选宽度
Returns:
number- Inherited From:
-
getButtons() → {Array.<any>}
-
获取底栏中的按钮数组
Returns:
Array.<any> -按钮数组,格式为:[{icon: 'icon', onClick: function(e) {} }, {icon: 'icon1', onClick: function(e) {} }]
- Inherited From:
-
getButtonVAlign() → {string}
-
获取底栏按钮的垂直对齐方式
Returns:
string -对齐方式,值可能为:'top'|'middle'|'bottom'
- Inherited From:
-
getButtonWidth(button) → {number}
-
获取底栏按钮的宽度,默认返回 preferredSize.width,可重写自定义
Parameters:
Name Type Description button
ht.ui.Button 按钮对象
Returns:
number -宽度值
- Inherited From:
-
getCenterPosition() → {Object}
-
根据屏幕大小和对话框本身宽高计算出显示在中心时的坐标并返回
Returns:
Object -坐标值
- Inherited From:
-
getChildAt(event) → {ht.ui.View}
-
获取鼠标事件下的子组件
Parameters:
Name Type Description event
number | MouseEvent | TouchEvent | Object - Inherited From:
-
getChildLayoutParams(child) → {any}
-
获取子组件的 layoutParams
Parameters:
Name Type Description child
ht.ui.View Returns:
any -layoutParams
- Inherited From:
-
getChildren() → {ht.List}
-
获取子组件列表
- Inherited From:
-
getClassName() → {string}
-
获取类名
Returns:
string- Inherited From:
-
getCloseIcon() → {any}
-
获取正常状态下关闭图标,可以是颜色或者图片等
Returns:
any -关闭图标
- Inherited From:
-
getCloseIconDrawable() → {ht.ui.drawable.Drawable}
-
获取正常状态下关闭图标的 Drawable 对象
- Inherited From:
-
getCloseToolIndex() → {number}
-
获取关闭按钮在工具按钮组中的显示顺序
Returns:
number -显示顺序
- Inherited From:
-
getCollapseIcon() → {any}
-
获取正常状态下合并图标,可以是颜色或者图片等
Returns:
any -合并图标
- Inherited From:
-
getCollapseIconDrawable() → {ht.ui.drawable.Drawable}
-
获取正常状态下合并图标的 Drawable 对象
- Inherited From:
-
getCollapseToolIndex() → {number}
-
获取展开合并按钮在工具按钮组中的显示顺序
Returns:
number -显示顺序
- Inherited From:
-
getColorMode() → {string}
-
Returns:
string- Inherited From:
-
getContentBottom() → {number}
-
获取内容底部距离,即底部边框高度加底部内边距高度
Returns:
number -内容底部距离
- Inherited From:
-
getContentDiv() → {HTMLElement}
-
获取内容 div;对于普通组件,contentDiv 里放置了 canvas 画布;对于容器组件,contentDiv 里除了画布,还有所有的子组件
Returns:
HTMLElement -内容 div
- Inherited From:
-
getContentHeight() → {number}
-
获取内容高度,即组件高度减去边框高度和上下内边距高度
Returns:
number -内容高度
- Inherited From:
-
getContentIcon() → {any}
-
获取内容区域的图标
Returns:
any -图标名称
-
getContentInput() → {ht.ui.View}
-
内容区域的输入组件,显示在 contentText 下方
-
getContentLeft() → {number}
-
获取内容左侧距离,即左侧边框宽度加左侧内边距宽度
Returns:
number -内容左侧距离
- Inherited From:
-
getContentPadding() → {number|Array.<number>}
-
获取内容区域的内边距
Returns:
number | Array.<number> -内边距
- Overrides:
-
getContentPoint(event) → {Object}
-
获取内容坐标点;此坐标与内边距和边框无关,是从内容区域左上角开始计算
Parameters:
Name Type Description event
any 交互事件对象(如鼠标事件对象)
Returns:
Object -内容坐标点,包含 x、y 坐标
- Inherited From:
-
getContentRight() → {number}
-
获取内容右侧距离,即右侧边框宽度加右侧内边距宽度
Returns:
number -内容右侧距离
- Inherited From:
-
getContentText() → {string}
-
获取内容文本
Returns:
string -内容文本
-
getContentTextColor() → {string}
-
获取内容文本的颜色值
Returns:
string -颜色值
-
getContentTextFont() → {string}
-
获取内容文本的字体
Returns:
string -字体
-
getContentTop() → {number}
-
获取内容顶部距离,即顶部边框高度加顶部内边距高度
Returns:
number -内容顶部距离
- Inherited From:
-
getContentView() → {ht.ui.View}
-
获取面板中的子组件
- Inherited From:
-
getContentWidth() → {number}
-
获取内容宽度,即组件宽度减去边框宽度和左右内边距宽度
Returns:
number -内容宽度
- Inherited From:
-
getContextMenu() → {ht.ui.ContextMenu}
-
获取绑定的右键菜单
- Inherited From:
-
getCurrentTitleColor(state) → {string}
-
根据标题栏状态,返回相应的颜色(normalTitleColor 或 hoverTitleColor 或 activeTitleColor);可重写自定义
Parameters:
Name Type Attributes Description state
string <optional>
状态,如果未指定,使用 panel.getHeaderState()
Returns:
string -颜色值
- Inherited From:
-
getCursor() → {string}
-
获取鼠标样式(CSS 格式)
Returns:
string -鼠标样式
- Inherited From:
-
getDisabledBackground() → {any}
-
组件被禁用时,遮罩的背景;这个值被设置到遮罩 div 的 background 样式上,因此可以使用所有 CSS 支持的 background 类型
Returns:
any -遮罩背景
- Inherited From:
-
getDOMProperties() → {any}
-
获取 DOM 属性映射表,格式为:{'width': true ...};这些属性发生变化才会更新 DOM 结构,否则只需要绘制内容即可
Returns:
any -DOM 属性映射表
- Inherited From:
-
getEnterHandler() → {Object}
-
获取用户按下 时要触发的事件处理器函数
Returns:
Object -
getErrorMessage() → {string}
-
获取错误信息
Returns:
string -错误信息
- Inherited From:
-
getEscHandler() → {Object}
-
获取用户按下 时要触发的事件处理器函数
Returns:
Object -
getExpandIcon() → {any}
-
获取正常状态下展开图标,可以是颜色或者图片等
Returns:
any -展开图标
- Inherited From:
-
getExpandIconDrawable() → {ht.ui.drawable.Drawable}
-
获取正常状态下展开图标的 Drawable 对象
- Inherited From:
-
getFixedWidth() → {number}
-
获取固定宽度;提示框的宽度会尽量以此宽度为准,高度自适应
Returns:
number -宽度值
-
getFooterBackground() → {any}
-
获取底栏背景,可以是颜色或者图片等
Returns:
any -背景
- Inherited From:
-
getFooterBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取底栏背景的 Drawable 对象
- Inherited From:
-
getFooterHeight() → {number}
-
获取底栏高度
Returns:
number -高度值
- Inherited From:
-
getFooterPaddingLeft() → {string}
-
获取底栏左侧内边距
Returns:
string -底栏左侧内边距
- Inherited From:
-
getFooterPaddingRight() → {string}
-
获取底栏右侧内边距
Returns:
string -底栏右侧内边距
- Inherited From:
-
getHeaderBackground() → {any}
-
获取正常状态下标题栏背景,可以是颜色或者图片等
Returns:
any -标题栏背景
- Inherited From:
-
getHeaderBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取正常状态下标题栏背景的 Drawable 对象
- Inherited From:
-
getHeaderHeight() → {number}
-
获取标题栏高度
Returns:
number -标题栏高度
- Inherited From:
-
getHeaderPaddingLeft() → {number}
-
获取标题栏左侧内边距
Returns:
number -左侧内边距
- Inherited From:
-
getHeaderPaddingRight() → {number}
-
获取标题栏右侧内边距
Returns:
number -右侧内边距
- Inherited From:
-
getHeaderState() → {string}
-
获取标题栏状态
Returns:
string -标题栏状态,值可能为:'normal'|'hover'|'active'
- Inherited From:
-
getHeight() → {number}
-
获取组件的高度
Returns:
number -组件高度
- Inherited From:
-
getHoverCloseIcon() → {any}
-
获取 Hover 状态下关闭图标,可以是颜色或者图片等
Returns:
any -关闭图标
- Inherited From:
-
getHoverCloseIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 Hover 状态下关闭图标的 Drawable 对象
- Inherited From:
-
getHoverCollapseIcon() → {any}
-
获取 Hover 状态下合并图标,可以是颜色或者图片等
Returns:
any -合并图标
- Inherited From:
-
getHoverCollapseIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 Hover 状态下合并图标的 Drawable 对象
- Inherited From:
-
getHoverExpandIcon() → {any}
-
获取 Hover 状态下展开图标,可以是颜色或者图片等
Returns:
any -展开图标
- Inherited From:
-
getHoverExpandIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 Hover 状态下展开图标的 Drawable 对象
- Inherited From:
-
getHoverHeaderBackground() → {any}
-
获取 Hover 状态下标题栏背景,可以是颜色或者图片等
Returns:
any -标题栏背景
- Inherited From:
-
getHoverHeaderBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取 Hover 状态下标题栏背景的 Drawable 对象
- Inherited From:
-
getHoverMaximizeIcon() → {any}
-
获取 Hover 状态下最大化图标,可以是颜色或者图片等
Returns:
any -最大化图标
- Inherited From:
-
getHoverMaximizeIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 Hover 状态下最大化图标的 Drawable 对象
- Inherited From:
-
getHoverRestoreIcon() → {any}
-
获取 Hover 状态下恢复图标,可以是颜色或者图片等
Returns:
any -恢复图标
- Inherited From:
-
getHoverRestoreIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 Hover 状态下恢复图标的 Drawable 对象
- Inherited From:
-
getHoverTitleColor() → {string}
-
获取 Hover 状态下标题文本颜色
Returns:
string -颜色值
- Inherited From:
-
getIcon() → {any}
-
获取标题栏图标,可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getIconDrawable() → {ht.ui.drawable.Drawable}
-
获取标题栏图标的 Drawable 对象
- Inherited From:
-
getIconHeight() → {number}
-
获取标题栏图标高度
Returns:
number -图标高度
- Inherited From:
-
getIconTitleGap() → {number}
-
获取标题栏图文字和图标之间的距离
Returns:
number -间距值
- Inherited From:
-
getIconWidth() → {number}
-
获取标题栏图标宽度
Returns:
number -图标宽度
- Inherited From:
-
getId() → {any}
-
获取唯一标识,根据标识可快速查找到组件
Returns:
any -唯一标识
- Inherited From:
-
getInteractorClasses() → {Array.<string>}
-
获取交互器类名数组
Returns:
Array.<string> -交互器类名数组
- Inherited From:
-
getLayoutParams(key) → {any}
-
获取布局参数
Parameters:
Name Type Attributes Description key
string <optional>
布局参数中的 key
Returns:
any -如果指定 key 参数返回布局参数中 key 对应的值,否则返回整个布局参数对象
- Inherited From:
-
getMargin() → {number|Array.<number>}
-
获取组件外边距,如果是数字,说明四边使用相同的外边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Returns:
number | Array.<number> -外边距
- Inherited From:
-
getMarginBottom() → {number}
-
获取组件底部外边距高度
Returns:
number -底部外边距高度
- Inherited From:
-
getMarginRight() → {number}
-
获取组件右侧外边距宽度
Returns:
number -右侧外边距宽度
- Inherited From:
-
getMarginTop() → {number}
-
获取组件顶部外边距高度
Returns:
number -顶部外边距高度
- Inherited From:
-
getMarignLeft() → {number}
-
获取组件左侧外边距宽度
Returns:
number -左侧外边距宽度
- Inherited From:
-
getMaskBackground() → {string}
-
获取遮罩背景;这个值被设置到遮罩 div 的 background 样式上,因此可以使用所有 CSS 支持的 background 类型
Returns:
string -遮罩背景
- Inherited From:
-
getMatchedStyles() → {any}
-
获取组件匹配到的样式
Returns:
any- Inherited From:
-
getMaximizeIcon() → {any}
-
获取正常状态下最大化图标,可以是颜色或者图片等
Returns:
any -最大化图标
- Inherited From:
-
getMaximizeIconDrawable() → {ht.ui.drawable.Drawable}
-
获取正常状态下最大化图标的 Drawable 对象
- Inherited From:
-
getMaximizeToolIndex() → {number}
-
获取最大化按钮在工具按钮组中的显示顺序
Returns:
number -显示顺序
- Inherited From:
-
getMaxSize() → {Object}
-
获取 maxSize,maxSize 表示组件自身最合适的尺寸;
如果用户没有设置,则调用 figureMaxSize 计算Returns:
Object -maxSize
- Inherited From:
-
getMaxSizeProperties() → {any}
-
获取 maxSize 属性映射表,格式为:{'border': true ...};这些属性变化会重新计算 maxSize
Returns:
any -maxSize 属性映射表
- Inherited From:
-
getMinSize() → {Object}
-
获取 minSize,minSize 表示组件的最小尺寸;
如果用户没有设置,则调用 figureMinSize 计算Returns:
Object -minSize
- Inherited From:
-
getMinSizeProperties() → {any}
-
获取 minSize 属性映射表,格式为:{'border': true ...};这些属性变化会重新计算 minSize
Returns:
any -minSize 属性映射表
- Inherited From:
-
getPadding() → {number|Array.<number>}
-
获取组件内边距,如果是数字,说明四边使用相同的内边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Returns:
number | Array.<number> -内边距
- Inherited From:
-
getPaddingBottom() → {number}
-
获取组件底部内边距高度
Returns:
number -底部内边距高度
- Inherited From:
-
getPaddingLeft() → {number}
-
获取组件左侧内边距宽度
Returns:
number -左侧内边距宽度
- Inherited From:
-
getPaddingRight() → {number}
-
获取组件右侧内边距宽度
Returns:
number -右侧内边距宽度
- Inherited From:
-
getPaddingTop() → {number}
-
获取组件顶部内边距高度
Returns:
number -顶部内边距高度
- Inherited From:
-
getParent() → {ht.ui.ViewGroup}
-
获取父容器
- Inherited From:
-
getPopover() → {ht.ui.Popover}
-
获取弹框组件
- Inherited From:
-
getPopoverPlacements() → {Array.<string>}
-
获取弹框组件的弹出位置
Returns:
Array.<string> -弹出位置
- Inherited From:
-
getPopoverTrigger() → {string}
-
获取弹框触发器
Returns:
string -弹框触发器,值为:click|hover
- Inherited From:
-
getPreferredSize() → {Object}
-
获取 preferredSize,preferredSize 表示组件自身最合适的尺寸,布局器布局时会考虑此尺寸;
如果用户没有设置,则调用 figurePreferredSize 计算Returns:
Object -preferredSize
- Inherited From:
-
getPreferredSizeProperties() → {any}
-
获取 preferredSize 属性映射表,格式为:{'border': true ...};这些属性变化会重新计算 preferredSize
Returns:
any -preferredSize 属性映射表
- Inherited From:
-
getPropertyValue(name) → {any}
-
取组件的某个属性的原始值;
不要直接去取私有变量,例如 padding,不要直接取 _padding 私有变量,而是应该使用此函数取值;
此函数取值顺序:
先取 _padding 私有变量
如果为 undefind,再去取样式表中取值
如果为 undefied,再取 __padding 私有变量Parameters:
Name Type Description name
string 属性名
Returns:
any -属性值
- Inherited From:
Example
// 这段代码演示了覆盖 getPadding 函数,先取出旧的 padding,再 +2 并返回 button.getPadding = function() { var oldPadding = this.getPropertyValue('padding'); oldPadding += 2; return oldPadding; }
-
getResizeBorderColor() → {string}
-
获取 resize 时提示边框颜色
Returns:
string -颜色值
- Inherited From:
-
getResizeDivAt(e) → {string}
-
获取事件对象下的 resize 区域
Parameters:
Name Type Description e
any 事件对象
Returns:
string -resize 区域名称,值可能为:'east'|'west'|'south'|'southwest'|'southeast'
- Inherited From:
-
getResizeLimit() → {Array.<string>}
-
获取拖拽边缘调整对话框尺寸时,限制操作的方向
Returns:
Array.<string> -限制操作的方向
- Inherited From:
-
getRestoreIcon() → {any}
-
获取正常状态下恢复图标,可以是颜色或者图片等
Returns:
any -恢复图标
- Inherited From:
-
getRestoreIconDrawable() → {ht.ui.drawable.Drawable}
-
获取正常状态下恢复图标的 Drawable 对象
- Inherited From:
-
getRootCanvas() → {HTMLCanvasElement}
-
获取根 Canvas,这个 Canvas 用来绘制背景、边框、内容等
Returns:
HTMLCanvasElement -Canvas DOM 对象
- Inherited From:
-
getRootContext(dom, ignoreCache) → {CanvasRenderingContext2D}
-
获取默认的 canvas 画布的画笔对象,或者获取参数 DOM 对象的画笔;
此函数在绘制背景、边框和自定义组件的情况下经常使用Parameters:
Name Type Attributes Description dom
HTMLElement <optional>
指定目标 DOM,通常是个 canvas 类型的 DOM 对象
ignoreCache
boolean <optional>
Returns:
CanvasRenderingContext2D -画笔对象
- Inherited From:
-
getScrollBarActiveSize() → {number}
-
获取滚动条感应区域的大小
Returns:
number -滚动条感应区域的大小
- Inherited From:
-
getScrollBarColor() → {string}
-
获取滚动条颜色
Returns:
string -颜色值
- Inherited From:
-
getScrollBarMinLength() → {number}
-
获取滚动条最小长度
Returns:
number -滚动条最小长度
- Inherited From:
-
getScrollBarMode() → {string}
-
获取滚动条模式,支持 'on'|'off'|'auto'|'hidden'
Returns:
string -滚动条模式
- Inherited From:
-
getScrollBarSize() → {number}
-
获取滚动条大小(横向滚动条的高度,纵向滚动条的宽度)
Returns:
number -滚动条大小
- Inherited From:
-
getScrollBarTimeout() → {number}
-
获取滚动条显示时间,超过时间后滚动条将隐藏
Returns:
number -滚动条显示时间
- Inherited From:
-
getScrollRect() → {Object}
-
获取滚动范围,即内容区域
Returns:
Object -内容区域,格式为:{x: x, y: y, width: width, height: height}
- Inherited From:
-
getStyle(property) → {any}
-
Parameters:
Name Type Description property
string Returns:
any- Inherited From:
-
getStyleProperties() → {any}
-
获取样式属性映射表,格式为:{'padding': true, 'border': true ...}
Returns:
any -样式属性映射表
- Inherited From:
-
getStyleValue(property) → {any}
-
获取样式属性对应的样式值
Parameters:
Name Type Description property
string 属性名
Returns:
any -样式值
- Inherited From:
-
getTitle() → {string}
-
获取标题文本
Returns:
string -标题文本
- Inherited From:
-
getTitleColor() → {string}
-
获取正常状态下标题文本颜色
Returns:
string -颜色值
- Inherited From:
-
getTitleFont() → {string}
-
获取标题文本字体
Returns:
string -标题文本字体
- Inherited From:
-
getToolAt(event) → {any}
-
获取事件对象下的工具按钮
Parameters:
Name Type Description event
any 事件对象
Returns:
any -工具按钮配置 json
- Inherited From:
-
getToolGap() → {number}
-
获取标题栏工具按钮之间的距离
Returns:
number -间距值
- Inherited From:
-
getToolHeight() → {number}
-
获取标题栏工具按钮高度
Returns:
number -高度值
- Inherited From:
-
getToolIndex(tool) → {number}
-
获取工具按钮的顺序
Parameters:
Name Type Description tool
any 工具按钮配置 json
Returns:
number -显示顺序
- Inherited From:
-
getTools() → {Array.<any>}
-
获取标题栏的工具按钮
Returns:
Array.<any> -工具按钮数组,格式为:[{icon: 'icon', onClick: function(e) {} }, {icon: 'icon1', onClick: function(e) {} }]
- Inherited From:
-
getToolsPosition() → {string}
-
获取标题栏工具按钮的位置
Returns:
string -工具按钮位置,值为 left|right
- Inherited From:
-
getToolTip(event) → {string}
-
获取工具提示文本内容
Parameters:
Name Type Attributes Description event
any <optional>
Returns:
string -工具提示文本内容
- Inherited From:
-
getToolWidth() → {number}
-
获取标题栏工具按钮宽度
Returns:
number -宽度值
- Inherited From:
-
getTranslateX() → {number}
-
获取水平滚动值
Returns:
number -水平滚动值
- Inherited From:
-
getTranslateY() → {number}
-
获取垂直滚动值
Returns:
number -垂直滚动值
- Inherited From:
-
getView() → {HTMLElement}
-
获取组件最根层的 div
Returns:
HTMLElement -组件 div
- Inherited From:
-
getViewPoint(event) → {Object}
-
获取组件坐标点;从组件的左上角开始计算
Parameters:
Name Type Description event
any 交互事件对象(如鼠标事件对象)
Returns:
Object -组件坐标点,包含 x、y 坐标
- Inherited From:
-
getViewRect() → {Object}
-
获取视窗范围,即可视区域
Returns:
Object -可见区域,格式为:{x: x, y: y, width: width, height: height}
- Inherited From:
-
getVisibleChildren() → {ht.List}
-
获取可见的子组件列表
- Inherited From:
-
getWidth() → {number}
-
获取组件的宽度
Returns:
number -组件宽度
- Inherited From:
-
getX() → {number}
-
获取组件的 x 坐标
Returns:
number -x 坐标
- Inherited From:
-
getY() → {number}
-
获取组件的 y 坐标
Returns:
number -y 坐标
- Inherited From:
-
getZIndex() → {number}
-
获取组件的堆叠顺序
Returns:
number -堆叠顺序
- Inherited From:
-
getZoom() → {number}
-
获取缩放值
Returns:
number -缩放值
- Inherited From:
-
getZoomAnchor() → {Array.<number>}
-
获取缩放锚点
Returns:
Array.<number> -锚点数组
- Inherited From:
-
hasContentCanvas() → {boolean}
-
判断组件是否有私有 canvas
Returns:
boolean -组件是否有私有 canvas
- Inherited From:
-
hasFocus() → {boolean}
-
判断焦点是否在组件上
Returns:
boolean -焦点是否在组件上
- Inherited From:
-
headerHitTest(event) → {boolean}
-
判断是否点击中标题栏
Parameters:
Name Type Description event
any 事件对象
Returns:
boolean -是否点击中分隔条
- Inherited From:
-
hide() → {void}
-
隐藏对话框
Returns:
void- Inherited From:
-
hidePopover() → {void}
-
隐藏弹框组件
Returns:
void- Inherited From:
-
hideToolTip() → {void}
-
隐藏 toolTip
Returns:
void- Inherited From:
-
initView(canvas) → {void}
-
初始化组件的 DOM 结构
Parameters:
Name Type Attributes Description canvas
boolean <optional>
是否创建一个私有的 canvas 用来绘制私有内容,一般情况下在默认的 canvas 中绘制就可以,不需要此参数
Returns:
void- Inherited From:
-
invalidate(forceLayoutChildren) → {void}
-
使组件无效化
Parameters:
Name Type Attributes Description forceLayoutChildren
boolean <optional>
是否强制刷新子组件(即使子组件没有无效标记)
Returns:
void- Inherited From:
-
invalidateDOM() → {void}
-
设置重新布局 DOM 标记并调用 invalidate, 组件下次刷新时会强制更新 DOM
Returns:
void- Inherited From:
-
isAutoResize() → {boolean}
-
判断对话框是否会自动按照首选大小调整自身尺寸
Returns:
boolean- Inherited From:
-
isClosable() → {boolean}
-
判断面板是否可关闭;如果为 true,在工具按钮中显示关闭按钮
Returns:
boolean -是否可关闭
- Inherited From:
-
isCloseToHScrollBar(e) → {void}
-
事件的坐标是否接近水平滚动条(接近的范围由 scrollBarActiveSize 决定)
Parameters:
Name Type Description e
MouseEvent | TouchEvent 鼠标或 Touch 事件对象
Returns:
void- Inherited From:
-
isCloseToVScrollBar(e) → {void}
-
事件的坐标是否接近垂直滚动条(接近的范围由 scrollBarActiveSize 决定)
Parameters:
Name Type Description e
MouseEvent | TouchEvent 鼠标或 Touch 事件对象
Returns:
void- Inherited From:
-
isCollapsable() → {boolean}
-
判断面板是否可合并;如果为 true,在工具按钮中显示展开合并按钮
Returns:
boolean -是否可展开合并
- Inherited From:
-
isDescendantOf(viewGroup) → {boolean}
-
判断当前组件是否是参数容器的子孙组件
Parameters:
Name Type Description viewGroup
ht.ui.ViewGroup 容器
Returns:
boolean- Inherited From:
-
isDisabled() → {boolean}
-
组件是否被禁用
Returns:
boolean -是否被禁用
- Inherited From:
-
isExpanded() → {boolean}
-
判断面板是否处于展开状态
Returns:
boolean -面板是否展开
- Inherited From:
-
isFixToCenter() → {boolean}
-
获取对话框是否固定在页面中心
Returns:
boolean- Inherited From:
-
isFloatLayout() → {boolean}
-
Returns:
boolean- Inherited From:
-
isFocusable() → {boolean}
-
组件是否可以获取焦点
Returns:
boolean -是否可获取焦点
- Inherited From:
-
isHeaderVisible() → {boolean}
-
判断标题栏是否可见
Returns:
boolean -是否可见
- Inherited From:
-
isHScrollable() → {boolean}
-
判断容器是否可以水平滚动(即 scrollRect.width > viewRect.width)
Returns:
boolean -是否可以水平滚动
- Inherited From:
-
isInDOM() → {boolean}
-
判断组件是否在 DOM 树中
Returns:
boolean -组件是否在 DOM 树中
- Inherited From:
-
isMaximizable() → {boolean}
-
判断面板是否可最大化;如果为 true,在工具按钮中显示最大化按钮
Returns:
boolean -是否可最大化
- Inherited From:
-
isMaximized() → {boolean}
-
判断面板是否处于最大化状态
Returns:
boolean -面板是否最大化
- Inherited From:
-
isMaxSizeSet() → {boolean}
-
判断 maxSize 是否被设置(如果为 true, 组件不再调用 figureMaxSize 自动计算)
Returns:
boolean -maxSize 是否被设置
- Inherited From:
-
isMinSizeSet() → {boolean}
-
判断 minSize 是否被设置(如果为 true, 组件不再调用 figureMinSize 自动计算)
Returns:
boolean -minSize 是否被设置
- Inherited From:
-
isModal() → {boolean}
-
判断是否是模态对话框
Returns:
boolean -是否为模态对话框
- Inherited From:
-
isMovable() → {boolean}
-
判断是否可移动
Returns:
boolean -是否可移动
- Inherited From:
-
isPreferredSizeSet() → {boolean}
-
判断 preferredSize 是否被设置(如果为 true, 组件不再调用 figurePreferredSize 自动计算)
Returns:
boolean -preferredSize 是否被设置
- Inherited From:
-
isRedrawOnFocus() → {boolean}
-
判断组件获取或失去焦点时,是否重绘自身
Returns:
boolean -是否重绘自身
- Inherited From:
-
isResizable() → {boolean}
-
判断是否可拖拽边缘调整对话框尺寸
Returns:
boolean -是否可拖拽边缘调整对话框尺寸
- Inherited From:
-
isSelfViewEvent(event) → {boolean}
-
判断鼠标事件是否发生在组件自身上,例如容器的 div 上监听到一个原生的鼠标点击事件,此事件可能来自容器,也可能来自子组件的冒泡传播;
如果自定义组件,并且改变了组件的 DOM 结构,需要重写此函数Parameters:
Name Type Description event
any 事件对象
Returns:
boolean -事件是否发生在自身 DOM 上
- Inherited From:
-
isStyleProperty(property) → {boolean}
-
判断属性是否是样式属性
Parameters:
Name Type Description property
string 属性名
Returns:
boolean -是否是样式属性
- Inherited From:
-
isToolTipEnabled() → {boolean}
-
是否启用工具提示
Returns:
boolean -是否启用工具提示
- Inherited From:
-
isVisible() → {boolean}
-
判断对话框是否可见
Returns:
boolean -是否可见
- Inherited From:
-
isVScrollable() → {boolean}
-
判断容器是否可以垂直滚动(即 scrollRect.height > viewRect.height)
Returns:
boolean -是否可以垂直滚动
- Inherited From:
-
iv(forceLayoutChildren) → {void}
-
使组件无效化
Parameters:
Name Type Attributes Description forceLayoutChildren
boolean <optional>
是否强制刷新子组件(即使子组件没有无效标记)
Returns:
void- Inherited From:
-
layoutChild(child, x, y, width, height) → {void}
-
布局子组件,设置组件的 x、y 坐标以及宽高并调用子组件的 validate;
如果自定义布局器,一般需要在 validateImpl 函数中调用此函数对子组件进行布局Parameters:
Name Type Description child
ht.ui.View 要布局的子组件
x
number 组件的 x 坐标
y
number 组件的 y 坐标
width
number 组件的宽度
height
number 组件的高度
Returns:
void- Inherited From:
-
layoutDOM(x, y, width, height) → {void}
-
重新调整组件的 DOM 结构布局,设置坐标、宽高以及内边距等
Parameters:
Name Type Attributes Description x
number 组件的 x 坐标
y
number <optional>
组件的 y 坐标
width
number <optional>
组件宽度
height
number <optional>
组件高度
Returns:
void- Inherited From:
-
makeDisabled(disabled, disabledDiv) → {void}
-
设置禁用组件样式,默认会将 disabedDiv 插入到组件内部
Parameters:
Name Type Description disabled
boolean 是否禁用
disabledDiv
HTMLElement 遮罩 div
Returns:
void- Inherited From:
-
makeFocus() → {void}
-
Returns:
void- Inherited From:
-
mp(listener, scope, ahead) → {void}
-
增加属性事件变化监听函数,addPropertyChangeListener 的缩写
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
ahead
boolean <optional>
是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
off(name, listener, scope) → {void}
-
删除事件监听
Parameters:
Name Type Attributes Description name
string 属性名,p: 开头(如 p:value),表示监听属性变化事件;d: 开头(如 d:mousedown) 表示监听原生 DOM 事件;其它情况当作 viewEvent 处理
listener
Object scope
any <optional>
监听器函数域
Returns:
void- Inherited From:
-
on(name, listener, scope, ahead) → {void}
-
增加事件监听
Parameters:
Name Type Attributes Description name
string 属性名,p: 开头(如 p:value),表示监听的是属性变化事件;d: 开头(如 d:mousedown) 表示监听原生 DOM 事件;其它情况当作 viewEvent 处理
listener
Object scope
any <optional>
监听器函数域
ahead
boolean <optional>
如果是 DOM 事件,表示 useCapture;否则表示是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
onOnce(name, listener, scope, ahead) → {void}
-
增加一次性事件监听(监听器执行一次,然后马上被删除)
Parameters:
Name Type Attributes Description name
string 属性名,p: 开头(如 p:value),表示监听属性变化事件;d: 开头(如 d:mousedown) 表示监听原生 DOM 事件;其它情况当作 viewEvent 处理
listener
Object scope
any <optional>
监听器函数域
ahead
boolean <optional>
如果是 DOM 事件,表示 useCapture;否则表示是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
onPropertyChanged(e) → {void}
-
属性变化回调
Parameters:
Name Type Description e
Object Returns:
void- Inherited From:
-
processValidate() → {void}
-
绘制组件边框、背景及调用 validateImpl;此函数在 validate 中被调用
Returns:
void- Inherited From:
-
redraw(forceLayoutChildren) → {void}
-
设置所有的重绘标记包括重绘 canvas 标记、重绘 border 标记和重新布局 DOM 标记 并调用 iv
Parameters:
Name Type Attributes Description forceLayoutChildren
boolean <optional>
是否强制刷新子组件(即使子组件没有无效标记)
Returns:
void- Inherited From:
-
removeButtonAt(index) → {void}
-
删除指定下标的底栏按钮
Parameters:
Name Type Description index
number 底栏按钮的下标
Returns:
void- Inherited From:
-
removeFromDOM() → {void}
-
将组件从页面的 DOM 树中删除;如果要删除通过 addToDOM 添加到页面的组件,应使用此函数,以免内存泄漏
Returns:
void- Inherited From:
-
removePropertyChangeListener(listener, scope) → {void}
-
删除属性事件变化监听器
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
Returns:
void- Inherited From:
-
removeStyleProperty(property) → {void}
-
删除样式属性,将参数属性从样式属性列表中移除
Parameters:
Name Type Description property
string 属性名
Returns:
void- Inherited From:
-
removeToolAt(index) → {void}
-
删除指定下标的工具按钮
Parameters:
Name Type Description index
number 工具按钮的下标
Returns:
void- Inherited From:
-
removeView(view) → {void}
-
将子组件从容器中删除
Parameters:
Name Type Description view
ht.ui.View 要删除的子组件
Returns:
void- Inherited From:
-
removeViewAt(index) → {void}
-
删除容器子组件列表中对应下标为 index 的子组件
Parameters:
Name Type Description index
number 子组件下标
Returns:
void- Inherited From:
-
removeViewListener(listener, scope) → {void}
-
删除 View 事件监听器
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
监听器函数域
Returns:
void- Inherited From:
-
requestFocus() → {void}
-
请求获取焦点
Returns:
void- Inherited From:
-
resetTranslate() → {any}
-
Returns:
any- Inherited From:
-
sendToTop() → {void}
-
Returns:
void- Inherited From:
-
set(properties) → {void}
-
批量设置组件属性
Parameters:
Name Type Description properties
any 格式示范:{ background: 'red', border: new ht.ui.border.LineBorder(1, 'red'), padding: 20 }
Returns:
void- Inherited From:
-
setActiveCloseIcon(icon) → {void}
-
设置 Active 状态下关闭图标
Parameters:
Name Type Description icon
any 关闭图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setActiveCloseIconDrawable(drawable) → {void}
-
设置 Active 状态下关闭图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 关闭图标
Returns:
void- Inherited From:
-
setActiveCollapseIcon(icon) → {void}
-
设置 Active 状态下合并图标
Parameters:
Name Type Description icon
any 合并图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setActiveCollapseIconDrawable(drawable) → {void}
-
设置 Active 状态下合并图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 合并图标
Returns:
void- Inherited From:
-
setActiveExpandIcon(icon) → {void}
-
设置 Active 状态下展开图标
Parameters:
Name Type Description icon
any 展开图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setActiveExpandIconDrawable(drawable) → {void}
-
设置 Active 状态下展开图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 展开图标
Returns:
void- Inherited From:
-
setActiveHeaderBackground(background) → {void}
-
设置 Active 状态下标题栏背景
Parameters:
Name Type Description background
any 标题栏背景,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setActiveHeaderBackgroundDrawable(drawable) → {void}
-
设置 Active 状态下标题栏背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 标题栏背景
Returns:
void- Inherited From:
-
setActiveMaximizeIcon(icon) → {void}
-
设置 Active 状态下最大化图标
Parameters:
Name Type Description icon
any 最大化图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setActiveMaximizeIconDrawable(drawable) → {void}
-
设置 Active 状态下最大化图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 最大化图标
Returns:
void- Inherited From:
-
setActiveRestoreIcon(icon) → {void}
-
设置 Active 状态下恢复图标,可以是颜色或者图片等
Parameters:
Name Type Description icon
any 恢复图标
Returns:
void- Inherited From:
-
setActiveRestoreIconDrawable(drawable) → {void}
-
设置 Active 状态下恢复图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 恢复图标
Returns:
void- Inherited From:
-
setActiveTitleColor(color) → {void}
-
设置 Active 状态下标题文本颜色
Parameters:
Name Type Description color
string 颜色值
Returns:
void- Inherited From:
-
setAttr(property, value) → {void}
-
Parameters:
Name Type Description property
string value
any Returns:
void- Inherited From:
-
setAutoResize(autoResize) → {void}
-
设置对话框是否自动按照首选大小调整自身尺寸
Parameters:
Name Type Description autoResize
boolean Returns:
void- Inherited From:
-
setBackground(background) → {void}
-
设置组件的背景,可以是颜色或者图片等;此值最终会被转换为 Drawable 对象
Parameters:
Name Type Description background
any 颜色值、图片名、图片路径、矢量对象等
Returns:
void- Inherited From:
-
setBackgroundDrawable(drawable) → {void}
-
设置组件的背景 Drawable 对象;组件渲染时优先使用此 Drawable 对象,如果为空,再用 background 转换
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable Drawable 对象
Returns:
void- Inherited From:
-
setBorder(border) → {void}
-
设置组件的边框
Parameters:
Name Type Description border
ht.ui.border.Border 组件边框
Returns:
void- Inherited From:
-
setBorderRadius(radius) → {void}
-
设置 CSS 边框圆角
Parameters:
Name Type Description radius
number | Array.<number> 边框圆角;如果是数组,则表示[左上角圆角、右上角圆角、右下角圆角、左下角圆角]
Returns:
void- Inherited From:
-
setBoxShadow(boxShadow) → {void}
-
设置 CSS 阴影值
Parameters:
Name Type Description boxShadow
string 阴影值
Returns:
void- Inherited From:
-
setButtonAlign(align) → {void}
-
设置底栏按钮的水平对齐方式
Parameters:
Name Type Description align
string 对齐方式,可选值为:'left'|'center'|'right'
Returns:
void- Inherited From:
-
setButtonGap(gap) → {void}
-
设置底栏按钮之间的距离
Parameters:
Name Type Description gap
number 间距值
Returns:
void- Inherited From:
-
setButtonPrefHeight(height) → {void}
-
设置对话框底部按钮的首选高度
Parameters:
Name Type Description height
number Returns:
void- Inherited From:
-
setButtonPrefWidth(width) → {void}
-
设置对话框底部按钮的首选宽度
Parameters:
Name Type Description width
number Returns:
void- Inherited From:
-
setButtons(buttons) → {void}
-
设置底栏中的按钮数组
Parameters:
Name Type Description buttons
Array.<any> 按钮数组
Returns:
void- Inherited From:
Example
dialog.setButtons([{ // 这里可配置所有按钮属性,如 text、textColor 等 icon: 'roundNormal', hoverIcon: 'roundHover', activeIcon: 'roundActive', onClick: function(event) { console.log('click tool', event); } }]);
-
setButtonVAlign(vAlign) → {void}
-
设置底栏按钮的垂直对齐方式
Parameters:
Name Type Description vAlign
string 对齐方式,可选值为:'top'|'middle'|'bottom'
Returns:
void- Inherited From:
-
setChildren(children) → {void}
-
设置子组件,会覆盖容器原有子组件
Parameters:
Name Type Description children
Array.<any> 子组件集合
Returns:
void- Inherited From:
-
setClosable(closable) → {void}
-
设置面板是否可关闭
Parameters:
Name Type Description closable
boolean 是否可关闭;如果为 true,在工具按钮中显示关闭按钮
Returns:
void- Inherited From:
-
setCloseIcon(icon) → {void}
-
设置正常状态下关闭图标
Parameters:
Name Type Description icon
any 关闭图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setCloseIconDrawable(drawable) → {void}
-
设置正常状态下关闭图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 关闭图标
Returns:
void- Inherited From:
-
setCloseToolIndex(index) → {void}
-
设置关闭按钮在工具按钮组中的显示顺序
Parameters:
Name Type Description index
number 显示顺序
Returns:
void- Inherited From:
-
setCollapsable(collapsable) → {void}
-
设置面板是否可合并
Parameters:
Name Type Description collapsable
boolean 是否可展开合并;如果为 true,在工具按钮组中显示展开合并按钮
Returns:
void- Inherited From:
-
setCollapseIcon(icon) → {void}
-
设置正常状态下合并图标
Parameters:
Name Type Description icon
any 合并图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setCollapseIconDrawable(drawable) → {void}
-
设置正常状态下合并图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 合并图标
Returns:
void- Inherited From:
-
setCollapseToolIndex(index) → {void}
-
设置展开合并按钮在工具按钮组中的显示顺序
Parameters:
Name Type Description index
number 显示顺序
Returns:
void- Inherited From:
-
setColorMode(mode) → {void}
-
Parameters:
Name Type Description mode
string Returns:
void- Inherited From:
-
setContentIcon(icon) → {void}
-
设置内容区域的图标
Parameters:
Name Type Description icon
any 图标名称
Returns:
void -
setContentInput(view) → {void}
-
设置内容区域的输入组件,显示在 contentText 下方
Parameters:
Name Type Description view
ht.ui.View 输入组件
Returns:
void -
setContentPadding(padding) → {void}
-
设置内容区域的内边距
Parameters:
Name Type Description padding
number | Array.<number> 内边距
Returns:
void- Overrides:
-
setContentText(text) → {void}
-
设置内容文本
Parameters:
Name Type Description text
string 内容文本
Returns:
void -
setContentTextColor(color) → {void}
-
设置内容文本的颜色值
Parameters:
Name Type Description color
string 颜色值
Returns:
void -
setContentTextFont(font) → {void}
-
设置内容文本的字体
Parameters:
Name Type Description font
string 字体
Returns:
void -
setContentView(view, layoutParams) → {void}
-
设置面板中的子组件
Parameters:
Name Type Attributes Description view
ht.ui.View 子组件
layoutParams
any <optional>
布局参数;可通过 childView.setLayoutPrams({...}) 提前设置并省略此参数
Returns:
void- Inherited From:
-
setContextMenu(contextMenu) → {void}
-
设置绑定的右键菜单
Parameters:
Name Type Description contextMenu
ht.ui.ContextMenu 右键菜单
Returns:
void- Inherited From:
-
setCursor(cursor) → {void}
-
设置鼠标样式(CSS 格式)
Parameters:
Name Type Description cursor
string 鼠标样式
Returns:
void- Inherited From:
-
setDisabled(disabled) → {void}
-
设置组件是否被禁用
Parameters:
Name Type Description disabled
string | boolean 是否被禁用;如果为字符串,组件除了被禁用,disabledDiv 还会被设置相应的 CSS 样式名
Returns:
void- Inherited From:
-
setDisabledBackground(background) → {void}
-
设置组件被禁用时,遮罩的背景;这个值被设置到遮罩 div 的 background 样式上,因此可以使用所有 CSS 支持的 background 类型
Parameters:
Name Type Description background
string 遮罩背景
Returns:
void- Inherited From:
Example
// 设置一个居中的 gif 图片 作为背景 view.setDisabledBackground('url(a.gif) no-repeat 50% 50%');
-
setEnterHandler(handler) → {void}
-
设置用户按下 时要触发的事件处理器函数
Parameters:
Name Type Description handler
Object Returns:
void -
setErrorMessage(message, params) → {ht.ui.Popover}
-
设置错误信息
Parameters:
Name Type Description message
string 错误信息
params
any ErrorMessagePopover 组件的属性配置,如 { placements: ['top'] } 将错误提示显示在上方
- Inherited From:
-
setEscHandler(handler) → {void}
-
设置用户按下 时要触发的事件处理器函数
Parameters:
Name Type Description handler
Object Returns:
void -
setExpanded(expanded) → {void}
-
设置面板展开合并状态
Parameters:
Name Type Description expanded
boolean 面板是否展开
Returns:
void- Inherited From:
-
setExpandIcon(icon) → {void}
-
设置正常状态下展开图标
Parameters:
Name Type Description icon
any 展开图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setExpandIconDrawable(drawable) → {void}
-
设置正常状态下展开图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 展开图标
Returns:
void- Inherited From:
-
setFixedWidth(width) → {void}
-
设置固定宽度;提示框的宽度会尽量以此宽度为准,高度自适应
Parameters:
Name Type Description width
number 宽度值
Returns:
void -
setFixToCenter(fixToCenter) → {void}
-
设置对话框是否固定在页面中心
Parameters:
Name Type Description fixToCenter
boolean Returns:
void- Inherited From:
-
setFloatLayout(floatLayout) → {void}
-
Parameters:
Name Type Description floatLayout
boolean Returns:
void- Inherited From:
-
setFocusable(focusable) → {void}
-
设置组件是否可以获取焦点
Parameters:
Name Type Description focusable
boolean 是否可获取焦点
Returns:
void- Inherited From:
-
setFooterBackground(background) → {void}
-
设置底栏背景
Parameters:
Name Type Description background
any Returns:
void- Inherited From:
-
setFooterBackgroundDrawable(drawable) → {void}
-
设置底栏背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 底栏背景
Returns:
void- Inherited From:
-
setFooterHeight(height) → {void}
-
设置底栏高度
Parameters:
Name Type Description height
number 高度值
Returns:
void- Inherited From:
-
setFooterPaddingLeft(paddingLeft) → {void}
-
设置底栏左侧内边距
Parameters:
Name Type Description paddingLeft
number 底栏左侧内边距
Returns:
void- Inherited From:
-
setFooterPaddingRight(paddingRight) → {void}
-
设置底栏右侧内边距
Parameters:
Name Type Description paddingRight
number 底栏右侧内边距
Returns:
void- Inherited From:
-
setFormDataName(name) → {any}
-
Parameters:
Name Type Description name
string Returns:
any- Inherited From:
-
setHeaderBackground(background) → {void}
-
设置正常状态下标题栏背景
Parameters:
Name Type Description background
any 标题栏背景,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setHeaderBackgroundDrawable(drawable) → {void}
-
设置正常状态下标题栏背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 标题栏背景
Returns:
void- Inherited From:
-
setHeaderHeight(height) → {void}
-
设置标题栏高度
Parameters:
Name Type Description height
number 标题栏高度
Returns:
void- Inherited From:
-
setHeaderPaddingLeft(paddingLeft) → {void}
-
设置标题栏左侧内边距
Parameters:
Name Type Description paddingLeft
number 左侧内边距
Returns:
void- Inherited From:
-
setHeaderPaddingRight(paddingRight) → {void}
-
设置标题栏右侧内边距
Parameters:
Name Type Description paddingRight
number 右侧内边距
Returns:
void- Inherited From:
-
setHeaderState(state) → {void}
-
设置标题栏状态
Parameters:
Name Type Description state
string 标题栏状态,可选值为:'normal'|'hover'|'active'
Returns:
void- Inherited From:
-
setHeaderVisible(visible) → {void}
-
设置标题栏是否可见
Parameters:
Name Type Description visible
boolean 是否可见
Returns:
void- Inherited From:
-
setHeight(height) → {void}
-
设置组件的高度
Parameters:
Name Type Description height
number 组件高度
Returns:
void- Inherited From:
-
setHoverCloseIcon(icon) → {void}
-
设置 Hover 状态下关闭图标
Parameters:
Name Type Description icon
any 关闭图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setHoverCloseIconDrawable(drawable) → {void}
-
设置 Hover 状态下关闭图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 关闭图标
Returns:
void- Inherited From:
-
setHoverCollapseIcon(icon) → {void}
-
设置 Hover 状态下合并图标
Parameters:
Name Type Description icon
any 合并图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setHoverCollapseIconDrawable(drawable) → {void}
-
设置 Hover 状态下合并图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 合并图标
Returns:
void- Inherited From:
-
setHoverExpandIcon(icon) → {void}
-
设置 Hover 状态下展开图标
Parameters:
Name Type Description icon
any 展开图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setHoverExpandIconDrawable(drawable) → {void}
-
设置 Hover 状态下展开图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 展开图标
Returns:
void- Inherited From:
-
setHoverHeaderBackground(background) → {void}
-
设置 Hover 状态下标题栏背景
Parameters:
Name Type Description background
any 标题栏背景,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setHoverHeaderBackgroundDrawable(drawable) → {void}
-
设置 Hover 状态下标题栏背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 标题栏背景
Returns:
void- Inherited From:
-
setHoverMaximizeIcon(icon) → {void}
-
设置 Hover 状态下最大化图标
Parameters:
Name Type Description icon
any 最大化图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setHoverMaximizeIconDrawable(drawable) → {void}
-
设置 Hover 状态下最大化图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 最大化图标
Returns:
void- Inherited From:
-
setHoverRestoreIcon(icon) → {void}
-
设置 Hover 状态下恢复图标
Parameters:
Name Type Description icon
any 恢复图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setHoverRestoreIconDrawable(drawable) → {void}
-
设置 Hover 状态下恢复图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 恢复图标
Returns:
void- Inherited From:
-
setHoverTitleColor(color) → {void}
-
设置 Hover 状态下标题文本颜色
Parameters:
Name Type Description color
string 颜色值
Returns:
void- Inherited From:
-
setIcon(icon) → {void}
-
设置标题栏图标
Parameters:
Name Type Description icon
any 图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setIconDrawable(drawable) → {void}
-
设置标题栏图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setIconHeight(height) → {void}
-
设置标题栏图标高度
Parameters:
Name Type Description height
number 图标高度
Returns:
void- Inherited From:
-
setIconTitleGap(gap) → {void}
-
设置标题栏图文字和图标之间的距离
Parameters:
Name Type Description gap
number 间距值
Returns:
void- Inherited From:
-
setIconWidth(width) → {void}
-
设置标题栏图标宽度
Parameters:
Name Type Description width
number 图标宽度
Returns:
void- Inherited From:
-
setId(id) → {void}
-
设置唯一标识,根据标识可快速查找到组件
Parameters:
Name Type Description id
string | number 唯一标识
Returns:
void- Inherited From:
-
setLayoutParams(layoutParams, value) → {void}
-
设置布局参数;这个函数有两种使用方式:
view.setLayoutParams({ marginLeft: 20, marginRight: 20 }) 指定布局参数对象
view.setLayoutParams('marginLeft', 20) 传入两个参数设置布局参数对象中的属性Parameters:
Name Type Attributes Description layoutParams
any <optional>
布局参数对象或 key
value
any <optional>
布局参数值
Returns:
void- Inherited From:
-
setLoading(arg0) → {void}
-
Parameters:
Name Type Description arg0
boolean Returns:
void- Inherited From:
-
setMargin(margin) → {void}
-
设置组件外边距,如果是数字,说明四边使用相同的外边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Parameters:
Name Type Description margin
number | Array.<number> 外边距;父容器布局时,会动态将此参数填充到 layoutParams 中(优先级低于 layoutParams,如果 layoutParams 参数中没有指定相应的 margin 才会从组件上取值)
Returns:
void- Inherited From:
-
setMaskBackground(background) → {void}
-
设置遮罩背景
Parameters:
Name Type Description background
string 遮罩背景;这个值被设置到遮罩 div 的 background 样式上,因此可以使用所有 CSS 支持的 background 类型
Returns:
void- Inherited From:
-
setMaximizable(maximizable) → {void}
-
设置面板是否可最大化
Parameters:
Name Type Description maximizable
boolean 是否可最大化;如果为 true,在工具按钮中显示最大化按钮
Returns:
void- Inherited From:
-
setMaximized(maximized) → {void}
-
设置面板是否处于最大化状态
Parameters:
Name Type Description maximized
boolean 面板是否最大化
Returns:
void- Inherited From:
-
setMaximizeIcon(icon) → {void}
-
设置正常状态下最大化图标
Parameters:
Name Type Description icon
any 最大化图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setMaximizeIconDrawable(drawable) → {void}
-
设置正常状态下最大化图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 最大化图标
Returns:
void- Inherited From:
-
setMaximizeToolIndex(index) → {void}
-
设置最大化按钮在工具按钮组中的显示顺序
Parameters:
Name Type Description index
number 显示顺序
Returns:
void- Inherited From:
-
setMaxSize(width, height) → {void}
-
Parameters:
Name Type Attributes Description width
number <optional>
height
number <optional>
Returns:
void- Inherited From:
-
setMemoryValidate(validate) → {void}
-
Parameters:
Name Type Description validate
boolean Returns:
void- Inherited From:
-
setMinSize(width, height) → {void}
-
Parameters:
Name Type Attributes Description width
number <optional>
height
number <optional>
Returns:
void- Inherited From:
-
setModal(modal) → {void}
-
设置是否是模态对话框
Parameters:
Name Type Description modal
boolean 是否为模态对话框
Returns:
void- Inherited From:
-
setMovable(movable) → {void}
-
设置是否可移动
Parameters:
Name Type Description movable
boolean 是否可移动
Returns:
void- Inherited From:
-
setOverflow(value) → {void}
-
Parameters:
Name Type Description value
"auto" | "clip" | "hidden" | "visible" | "scroll" Returns:
void- Inherited From:
-
setPadding(padding) → {void}
-
设置组件内边距,如果是数字,说明四边使用相同的内边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Parameters:
Name Type Description padding
number | Array.<Number> 内边距
Returns:
void- Inherited From:
-
setPopover(popover, trigger) → {void}
-
设置弹框组件
Parameters:
Name Type Attributes Description popover
string | ht.ui.Popover 弹框组件,如果参数是字符串,则用这段文本作为弹框内容(内部自动创建 Popover 和 HtmlView 组件)
trigger
string <optional>
触发器,值为:click|hover
Returns:
void- Inherited From:
-
setPopoverPlacements(placements) → {void}
-
设置弹框组件的弹出位置
Parameters:
Name Type Description placements
Array.<string> 位置数组
Returns:
void- Inherited From:
-
setPopoverTrigger(trigger) → {void}
-
设置弹框触发器
Parameters:
Name Type Description trigger
string 弹框触发器,值为:click|hover
Returns:
void- Inherited From:
-
setPreferredSize(width, height) → {void}
-
设置 preferredSize,preferredSize 表示组件自身最合适的尺寸,布局器布局时会考虑此尺寸作为布局尺寸;
如果设置过 preferredSize,就不会再调用 figurePreferredSize 计算;
如果要清空设置过的 preferredSize,可以调用 setPreferredSize(undefined, undefined);Parameters:
Name Type Attributes Description width
number | Size2d <optional>
首选宽度
height
number <optional>
首选高度
Returns:
void- Inherited From:
-
setPropertyValue(name, value) → {void}
-
设置属性值并派发事件,自定义 set 函数内部应该调用此函数设值
Parameters:
Name Type Description name
string 属性名
value
any 属性值
Returns:
void- Inherited From:
-
setRedrawOnFocus(redrawOnFocus) → {void}
-
设置组件获取或失去焦点时,是否重绘自身
Parameters:
Name Type Description redrawOnFocus
boolean 是否重绘自身
Returns:
void- Inherited From:
-
setResizable(resizable) → {void}
-
设置是否可拖拽边缘调整对话框尺寸
Parameters:
Name Type Description resizable
boolean 是否可拖拽边缘调整对话框尺寸
Returns:
void- Inherited From:
-
setResizeBorderColor(color) → {void}
-
设置 resize 时提示边框颜色
Parameters:
Name Type Description color
string 颜色值
Returns:
void- Inherited From:
-
setResizeLimit(resizeLimit) → {void}
-
设置拖拽边缘调整对话框尺寸时,限制操作的方向
Parameters:
Name Type Description resizeLimit
Array.<string> 限制操作的方向
Returns:
void- Inherited From:
-
setRestoreIcon(icon) → {void}
-
设置正常状态下恢复图标
Parameters:
Name Type Description icon
any 恢复图标,可以是颜色或者图片等
Returns:
void- Inherited From:
-
setRestoreIconDrawable(drawable) → {void}
-
设置正常状态下恢复图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 恢复图标
Returns:
void- Inherited From:
-
setScrollBarActiveSize(activeSize) → {void}
-
设置滚动条感应区域的大小
Parameters:
Name Type Description activeSize
number 滚动条感应区域的大小
Returns:
void- Inherited From:
-
setScrollBarColor(color) → {void}
-
设置滚动条颜色
Parameters:
Name Type Description color
string 颜色值
Returns:
void- Inherited From:
-
setScrollBarMinLength(length) → {void}
-
设置滚动条最小长度
Parameters:
Name Type Description length
number 滚动条最小长度
Returns:
void- Inherited From:
-
setScrollBarMode(mode) → {void}
-
设置滚动条模式
Parameters:
Name Type Description mode
string 滚动条模式,可选值为:'on'|'off'|'auto'|'hidden'
Returns:
void- Inherited From:
-
setScrollBarSize(size) → {void}
-
设置滚动条大小(横向滚动条的高度,纵向滚动条的宽度)
Parameters:
Name Type Description size
number 滚动条大小
Returns:
void- Inherited From:
-
setScrollBarTimeout(timeout) → {void}
-
设置滚动条显示时间,超过时间后滚动条将隐藏
Parameters:
Name Type Description timeout
number 滚动条显示时间
Returns:
void- Inherited From:
-
setStyle(property, value) → {void}
-
Parameters:
Name Type Description property
string value
any Returns:
void- Inherited From:
-
setTitle(title) → {void}
-
设置标题文本
Parameters:
Name Type Description title
string 标题文本
Returns:
void- Inherited From:
-
setTitleColor(color) → {void}
-
设置正常状态下标题文本颜色
Parameters:
Name Type Description color
string 颜色值
Returns:
void- Inherited From:
-
setTitleFont(font) → {void}
-
设置标题文本字体
Parameters:
Name Type Description font
string 标题文本字体,如 '12px Arial'
Returns:
void- Inherited From:
-
setToolGap(gap) → {void}
-
设置标题栏工具按钮之间的距离
Parameters:
Name Type Description gap
number 间距值
Returns:
void- Inherited From:
-
setToolHeight(height) → {void}
-
设置标题栏工具按钮高度
Parameters:
Name Type Description height
number 高度值
Returns:
void- Inherited From:
-
setTools(tools) → {void}
-
设置标题栏的工具按钮
Parameters:
Name Type Description tools
Array.<any> Returns:
void- Inherited From:
Example
panel.setTools([{ icon: 'roundNormal', hoverIcon: 'roundHover', activeIcon: 'roundActive', onClick: function(event) { console.log('click tool', event); } }]);
-
setToolsPosition(position) → {void}
-
设置标题栏工具按钮的位置
Parameters:
Name Type Description position
string 工具按钮位置,值为:left|right
Returns:
void- Inherited From:
-
setToolTipEnabled(enabled) → {void}
-
设置是否启用工具提示
Parameters:
Name Type Description enabled
boolean 是否启用工具提示
Returns:
void- Inherited From:
-
setToolTipPlacements(placements) → {any}
-
Parameters:
Name Type Description placements
Array.<string> Returns:
any- Inherited From:
-
setToolWidth(width) → {void}
-
设置标题栏工具按钮宽度
Parameters:
Name Type Description width
number 宽度值
Returns:
void- Inherited From:
-
setTranslate(translateX, translateY, anim) → {void}
-
设置水平和垂直滚动值
Parameters:
Name Type Attributes Description translateX
number 水平滚动值
translateY
number <optional>
垂直滚动值
anim
boolean <optional>
是否使用动画
Returns:
void- Inherited From:
-
setTranslateX(translateX) → {void}
-
设置水平滚动值
Parameters:
Name Type Description translateX
number 水平滚动值
Returns:
void- Inherited From:
-
setTranslateY(translateY) → {void}
-
设置垂直滚动值
Parameters:
Name Type Description translateY
number 垂直滚动值
Returns:
void- Inherited From:
-
setVisible(visible) → {void}
-
设置对话框是否可见;不要调用此函数,如果要显示对话框用 show 函数(但是可以通过监听 visible 属性变化来处理对话框显示和隐藏事件)
Parameters:
Name Type Description visible
boolean Returns:
void- Inherited From:
-
setWidth(width) → {void}
-
设置组件的宽度
Parameters:
Name Type Description width
number 组件宽度
Returns:
void- Inherited From:
-
setX(x) → {void}
-
设置组件的 x 坐标
Parameters:
Name Type Description x
number x 坐标
Returns:
void- Inherited From:
-
setY(y) → {void}
-
设置组件的 y 坐标
Parameters:
Name Type Description y
number y 坐标
Returns:
void- Inherited From:
-
setZIndex(zIndex) → {void}
-
设置组件的堆叠顺序
Parameters:
Name Type Description zIndex
number 堆叠顺序
Returns:
void- Inherited From:
-
setZoom(zoom) → {void}
-
设置缩放
Parameters:
Name Type Description zoom
number 缩放值
Returns:
void- Inherited From:
-
setZoomAnchor(anchor) → {void}
-
设置缩放锚点
Parameters:
Name Type Description anchor
Array.<number> 横向和纵向锚点数组,如右上角为:[1, 0]
Returns:
void- Inherited From:
-
show(x, y) → {void}
-
显示对话框
Parameters:
Name Type Attributes Description x
number <optional>
x 坐标
y
number <optional>
y 坐标
Returns:
void- Inherited From:
Example
// 对话框显示在屏幕中心 dialog.setWidth(600); dialog.setHeight(300); var center = dialog.getCenterPosition(); dialog.show(center.x, center.y);
-
showHScrollBar() → {void}
-
显示水平滚动条
Returns:
void- Inherited From:
-
showPopover() → {void}
-
显示弹框组件
Returns:
void- Inherited From:
-
showScrollBar() → {void}
-
显示滚动条,内部会调用 showVScrollBar() 和 showHScrollBar()
Returns:
void- Inherited From:
-
showToolTip(moveEvent) → {void}
-
显示 toolTip
Parameters:
Name Type Description moveEvent
MouseEvent | TouchEvent 鼠标事件对象
Returns:
void- Inherited From:
-
showVScrollBar() → {void}
-
显示垂直滚动条
Returns:
void- Inherited From:
-
tearDownBorder(border, x, y, width, height, dom) → {void}
-
卸载边框;只有 CSS 类型的边框才需要此函数
Parameters:
Name Type Attributes Description border
ht.ui.border.Border <optional>
边框对象
x
number <optional>
起点 x 坐标
y
number <optional>
起点 y 坐标
width
number <optional>
宽度
height
number <optional>
高度
dom
HTMLElement <optional>
指定绘制的目标 DOM
Returns:
void- Inherited From:
-
translate(x, y, anim) → {void}
-
水平滚动值增加 x,垂直滚动值增加 y
Parameters:
Name Type Attributes Description x
number 水平滚动值增量
y
number <optional>
垂直滚动值增量
anim
boolean <optional>
是否使用动画
Returns:
void- Inherited From:
-
tx(value) → {number|void}
-
获取或设置水平滚动值
Parameters:
Name Type Attributes Description value
number <optional>
如果为空,相当于 getTranslateX();如果不为空,相当于 setTranslateX(value)
Returns:
number | void- Inherited From:
-
ty(value) → {number|void}
-
获取或设置垂直滚动值
Parameters:
Name Type Attributes Description value
number <optional>
如果为空,相当于 getTranslateY();如果不为空,相当于 setTranslateY(value)
Returns:
number | void- Inherited From:
-
ump(listener, scope) → {void}
-
删除属性事件变化监听器,removePropertyChangeListener 的缩写
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
Returns:
void- Inherited From:
-
updateScrollBar(width, height, scrollWidth, scrollHeight) → {void}
-
更新滚动条;如果布局器需要滚动条,应该在 validateImpl 函数的末尾调用此函数更新滚动条
Parameters:
Name Type Description width
number 组件布局宽度
height
number 组件布局高度
scrollWidth
number 组件内容宽度
scrollHeight
number 组件内容高度
Returns:
void- Inherited From:
-
validate() → {void}
-
重绘组件;此函数负责重新布局组件 DOM、设置层叠关系、加载需要的图片资源、派发 validate 事件等
如果自定义组件,不要重写此函数,而是重写 validateImpl 函数Returns:
void- Inherited From:
-
validateImpl(x, y, width, height) → {void}
-
绘制组件内容;如果自定义组件,一般要重写此函数,通过 getRootContext() 获取画笔然后绘制
Parameters:
Name Type Attributes Description x
number <optional>
内容范围的 x 坐标
y
number <optional>
内容范围的 y 坐标
width
number <optional>
内容范围宽度
height
number <optional>
内容范围高度
Returns:
void- Inherited From: