代码改变世界

补充部分官方文档里没有的Client Library以及代码提示Schema更新(一)

2006-09-26 20:49  Jeffrey Zhao  阅读(1932)  评论(8编辑  收藏  举报
  为了保证Intelligence Schema的正确性,不得不仔细地去挖掘文档上没有描述的特性,最好的方式自然是阅读它的代码,似乎进展还算顺利。新增支持的Tag为validator相关和floatingBehavior,具体如下:

<requiredFieldValidator />
<typeValidator />
<rangeValidator />
<regexValidator />
<customValidator />
<validationErrorLabel />
<validationGroupt />
<floatingBehavior />

Schema已经更新,可以点击这里下载。使用方式可以见我前一篇文章《为VS.NET 2005增加Atlas Scripts的代码提示功能》,那里的Schema下载也以更新。

在研究floatingBehavior之后,发现目前似乎缺少对于其location属性和move事件的介绍,因此另外写了一篇文章《FloatingBehavior补遗:Location属性与move事件》对此作了简单的介绍。

有朋友向我反映说,使用了Schema之后再输入page这个tag时,总是会自动变成<page />,很不方便,这只要设定一下VS即可:选择菜单Tools——Options,在左侧树装菜单中选择Text Editor——HTML——Format,接着在右侧点击Tag Specific Options按钮,如图:


接着在弹出窗口中选择ASP.NET Controls——Page,然后在右侧将“Closing tag”设为“Separate cloasing tag”,如图:


这样,再次输入page时,就会出现<page></page>而不是<page />了。


以下是自制的Class Library,为了方便自己和需要的朋友作为参考。其中可以发现继承于Sys.Component的类都会有id和dataContext两个属性,我也如官方Class Library一般列出,虽然可能不会用到。

另外,如果有朋友发现问题请及时指出:



RequiredFieldValidator Class


The validator class which fires an error if the field on which the validator is configured is empty.

Syntax

Javascript

new Sys.UI.RequiredFieldValidator();

Declarative

<requiredFieldValidator
    dataContext
="source for data binding operations"
    
errorMessage="the error message"
    id="identifier for looking up the component by name"
    propertyChanged="event handler"

>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</requiredFieldValidator>

Script components:  required

Inherits:  Sys.UI.Validator




TypeValidator Class

The validator class which fires an error if the field on witch the validator is configured is not in the specific type.

Syntax

Javascript

new Sys.UI.TypeValidator();

Declarative

<typeValidator
    dataContext
="source for data binding operations"
    
errorMessage="the error message"
    id="identifier for looking up the component by name"
    propertyChanged="event handler"
    type
="Number|String|Boolean"
>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</typeValidator>

Script components:  required

Inherits:  Sys.UI.Validator




RangeValidator Class

The validator class which fires an error if the field on witch the validator is configured is not in the specific range.

Syntax

Javascript


new Sys.UI.RangeValidator();

Declarative

<rangeValidator
    dataContext
="source for data binding operations"
    
errorMessage="the error message"
    id="identifier for looking up the component by name"

    lowerBound
="the lower bound"
    propertyChanged="event handler"
    upperBound
="the upper bound"
>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</rangeValidator>

Script components:  required

Inherits:  Sys.UI.Validator




RegexValidator Class

The validator class which fires an error if the field on witch the validator is configured is not match the regular expresstion.

Syntax

Javascript


new Sys.UI.RegexValidator();

Declarative

<regexValidator
    dataContext
="source for data binding operations"
    
errorMessage="the error message"
    id="identifier for looking up the component by name"
    propertyChanged="event handler"
    regex
="the regular expression"
>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</regexValidator>

Script components:  required

Inherits:  Sys.UI.Validator




CustomValidator Class

The validator class which fires an error if the field on witch the validator is configured is not pass the validation events.

Syntax

Javascript


new Sys.UI.CustomValidator();

Declarative

<rangeValidator
    dataContext
="source for data binding operations"
    
errorMessage="the error message"
    id="identifier for looking up the component by name"
    propertyChanged="event handler"
    validateValue
="validation event handler"
>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</customValidator>

Script components:  required

Inherits:  Sys.UI.Validator




ValidationErrorLabel Class

The label to show the error message of a control which is being validated.

Syntax

Javascript


= new Sys.UI.ValidationErrorLabel(associatedElement)
    .
    .
c.initialize();

Declarative

<validationErrorLabel
    
accessKey="accelerator key"
    associatedControl
="the associated control being validated"

    cssClass
="CSS class"
    dataContext
="source for data binding operations"
    enabled
="true|false"
    htmlEncode
="false|true"
    id
="identifier for looking up the component by name"
    propertyChanged
="event handler"
    tabIndex
="element's tab index"
    text
="control value"
    visibilityMode
="Hidden|Collapse"
    visible
="true|false"
>
    
<behaviors>
        
<!-- behaviors -->
    
</behaviors>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</validationErrorLabel>

Script components:  required

Inherits:  Sys.UI.Label




ValidationGroup Class

The control group the controls which are being validated.

Syntax

Javascript


= new Sys.UI.ValidationGroup();
    .
    .
c.initialize();

Declarative

<validationGroup
    dataContext
="source for data binding operations"
    
id="identifier for looking up the component by name"
    propertyChanged="event handler"
>
    
<associatedControls>
        
<reference component="the control which is being validated" />
        
<!-- other references -->
    
</associatedControls>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>

</validationGroup>

Script components:  required

Inherits:  Sys.UI.Component




FloatingBehavior Class

Make a control float on the page.

Syntax

Javascript


new Sys.UI.FloatingBehavior();

Declarative

<floatingBehavior
    dataContext
="source for data binding operations"
    
handle="the handle to move the floating control"
    id="identifier for looking up the component by name"

    location
="a string like 'x,y' to indicate the position"
    move="event handler"
    propertyChanged="event handler"
>
    
<bindings>
        
<!-- bindings -->
    
</bindings>
    
<move>
        
<!-- actions -->
    
</move>
    
<propertyChanged>
        
<!-- actions -->
    
</propertyChanged>
</floatingBehavior>

Script components:  required

Inherits:  Sys.UI.Behavior