コントロールのプロパティーの追加

Functional Tester は、アクセスとプロパティー検査のためのコントロールのプロパティーのセットを提供します。 コントロールのプロパティーは、getProperties() および getProperty() API を拡張することによって追加することができます。
拡張可能なプロキシー・メソッドが表 1 にリストされています。
表 1. 拡張可能なプロキシー・メソッド
Java .Net
java.util.Hashtable getProperties() System.Collections.Hashtable GetProperties()
Object getProperty(String propertyName) object GetProperty(string propertyName)
以下のサンプルは、新規プロパティー ToolTipText を追加します。 同じ方法で、プロパティーを必要な数だけ追加することができます。

以下のサンプルは、Java™ で新規プロパティーを追加する方法を示しています。

import com.rational.test.ft.domain.*;

public class someProxy extends baseProxy
{
 .
 .
 public java.util.Hashtable getProperties()
 {
    java.util.Hashtable properties = super.getProperties();
    try
    {
	properties.put("toolTipText", getTooltipText());
    }
    catch (Throwable e)
    {
    } // in the odd case we can't get the artifical properties, just ignore them.
    return properties; 
 }
 .
 .
 .
 public Object getProperty(String propertyName)
 {
    if (propertyName.equals("toolTipText"))
	return getTooltipText();
    return super.getProperty(propertyName);
 } 
}

以下のサンプルは、.Net で新規プロパティーを追加する方法を示しています。

using Rational.Test.Ft.Domain;

public class AnyProxy:BaseProxy
{
     .
     .
     .
    public override System.Collections.Hashtable GetProperties()
    {
        System.Collections.Hashtable propertyTable = base.GetProperties();
        
         if( !propertyTable.Contains("ToolTipText"))
         {
	object text = GetToolTipText();
	if (text != null)
	  propertyTable.Add("ToolTipText", text );
         }
         return propertyTable;
    }
    .
    .
    .
   public override object GetProperty(string propertyName)
   {
       object propertyValue = null ;
       if (propertyName == "ToolTipText" )
       {
         propertyValue = GetToolTipText();
       }	
       else 
       {
         propertyValue = base.GetProperty(propertyName) ;
       }
       return propertyValue ;
   }
このプロキシー・コードを正常に開発してデプロイした後、新規プロパティー ToolTipText がコントロールに追加されます。 これは、コントロールに対して getProperty("toolTipText") API を実行することによって検査することができます。
関連タスク
プロキシー・クラスの作成
コントロールのデータ型の追加
記録動作の拡張
SubItem による記録動作の拡張
データ駆動の拡張
コントロールの役割の変更
コントロールの認識プロパティーと重みの変更
コントロールのマップ可能性の変更

フィードバック