new FocusLineBorder(width, color, focusColor, radius)
FocusLineBorder 类从 ht.ui.border.Border 继承,在组件的画布上根据组件 focus 状态绘制不同颜色的直线边框;使用此边框时需要将组件的 redrawOnFocus 属性设为 true
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
width | 
            
            number | Array.<number> | ||
color | 
            
            string | ||
focusColor | 
            
            string | ||
radius | 
            
            number | Array.<number> | 
                
                    <optional> | 
            
            
            
Example
button.setBorder(new ht.ui.border.FocusLineBorder(1, 'red', 'green'));
button.setRedrawOnFocus(true);
    
Extends
Methods
- 
    
        
addPropertyChangeListener(listener, scope, ahead) → {void}
 - 
    
    
增加属性事件变化监听函数
Parameters:
Name Type Attributes Description listenerObject 监听器函数
scopeany <optional> 
函数域
aheadboolean <optional> 
是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
 
 - 
    
        
drawBorder(x, y, width, height, view, dom) → {void}
 - 
    
    
绘制 border,如果自定义 border,都需要重写此函数
Parameters:
Name Type Attributes Description xnumber 绘制范围的 x 坐标
ynumber 绘制范围的 y 坐标
widthnumber 绘制范围的宽度
heightnumber 绘制范围的高度
viewht.ui.View 当前在绘制的组件
domHTMLElement <optional> 
当前在绘制的 dom 对象,绝大多数组件无需考虑这个参数(因为只有一个绘制 canvas),特殊情况下如右键菜单,每个子菜单都是一个单独的 canvas,这种情况下才有这个参数
Returns:
void- Inherited From:
 
 - 
    
        
firePropertyChange(property, oldValue, newValue, compareFunc) → {boolean}
 - 
    
    
派发属性变化事件
Parameters:
Name Type Attributes Description propertystring 属性名
oldValueany 属性变化之前的值
newValueany 属性变化之后的值
compareFuncObject <optional> 
比较函数,用于比较新值和旧值是否一致,如果一致则不会派发事件
Returns:
boolean -事件是否派发成功
- Inherited From:
 
 - 
    
        
fp(property, oldValue, newValue, compareFunc) → {boolean}
 - 
    
    
派发属性变化事件,firePropertyChange 的缩写
Parameters:
Name Type Attributes Description propertystring 属性名
oldValueany 属性变化之前的值
newValueany 属性变化之后的值
compareFuncObject <optional> 
比较函数,用于比较新值和旧值是否一致,如果一致则不会派发事件
Returns:
boolean -事件是否派发成功
- Inherited From:
 
 - 
    
        
getBottom() → {number}
 - 
    
    
返回边框底部的高度
Returns:
number -底部高度
- Inherited From:
 
 - 
    
        
getColor() → {string}
 - 
    
    
返回边框颜色
Returns:
string -颜色值
 - 
    
        
getFocusColor() → {string}
 - 
    
    
返回 focus 状态时的边框颜色
Returns:
string -颜色值
 - 
    
        
getLeft() → {number}
 - 
    
    
返回边框左侧的宽度
Returns:
number -左侧宽度
- Inherited From:
 
 - 
    
        
getRadius() → {number|Array.<number>}
 - 
    
    
返回边框圆角半径
Returns:
number | Array.<number> -边框圆角半径
 - 
    
        
getRight() → {number}
 - 
    
    
返回边框右侧的宽度
Returns:
number -右侧宽度
- Inherited From:
 
 - 
    
        
getSerializableProperties() → {any}
 - 
    
    
获取可序列化的属性
Returns:
any -属性 map
- Inherited From:
 
 - 
    
        
getTop() → {number}
 - 
    
    
返回边框顶部的高度
Returns:
number -顶部高度
- Inherited From:
 
 - 
    
        
getWidth() → {number|Array.<number>}
 - 
    
    
返回边框宽度
Returns:
number | Array.<number> -边框宽度,默认为 1
 - 
    
        
isCSSBorder() → {boolean}
 - 
    
    
此边框是否使用 CSS 设置 border
Returns:
boolean -是否是 CSS border
- Inherited From:
 
 - 
    
        
mp(listener, scope, ahead) → {void}
 - 
    
    
增加属性事件变化监听函数,addPropertyChangeListener 的缩写
Parameters:
Name Type Attributes Description listenerObject 监听器函数
scopeany <optional> 
函数域
aheadboolean <optional> 
是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
 
 - 
    
        
removePropertyChangeListener(listener, scope) → {void}
 - 
    
    
删除属性事件变化监听器
Parameters:
Name Type Attributes Description listenerObject 监听器函数
scopeany <optional> 
函数域
Returns:
void- Inherited From:
 
 - 
    
        
setColor(color) → {void}
 - 
    
    
设置边框颜色
Parameters:
Name Type Description colorstring 颜色值
Returns:
void - 
    
        
setFocusColor(focusColor) → {void}
 - 
    
    
设置 focus 状态时的边框颜色
Parameters:
Name Type Description focusColorstring 颜色值
Returns:
void - 
    
        
setRadius(radius) → {void}
 - 
    
    
设置边框圆角半径
Parameters:
Name Type Description radiusnumber | Array.<number> 边框圆角半径,如果为数组则表示:[左上角圆角, 右上角圆角, 右下角圆角, 左下角圆角]
Returns:
void - 
    
        
setWidth(width) → {void}
 - 
    
    
设置边框宽度
Parameters:
Name Type Description widthnumber | Array.<number> 边框宽度,默认为 1;如果为数组表示:[上边框宽度、右边框宽度、下边框宽度、左边框宽度]
Returns:
void - 
    
        
tearDownBorder(x, y, width, height, view, dom) → {void}
 - 
    
    
border 被卸载时调用,只有 CSS border 才需要重写这个函数将 CSS 清除,一般用 canvas 绘制的 border 无需重写此函数
Parameters:
Name Type Attributes Description xnumber 绘制范围的 x 坐标
ynumber 绘制范围的 y 坐标
widthnumber 绘制范围的宽度
heightnumber 绘制范围的高度
viewht.ui.View 当前在绘制的组件
domHTMLElement <optional> 
当前在绘制的 dom 对象,绝大多数组件无需考虑这个参数(因为只有一个绘制 canvas),特殊情况下如右键菜单,每个子菜单都是一个单独的 canvas,这种情况下才有这个参数
Returns:
void- Inherited From:
 
 - 
    
        
ump(listener, scope) → {void}
 - 
    
    
删除属性事件变化监听器,removePropertyChangeListener 的缩写
Parameters:
Name Type Attributes Description listenerObject 监听器函数
scopeany <optional> 
函数域
Returns:
void- Inherited From: