基本的なカスタマイズ > ユーザーインタフェースのカスタマイズ > UI の情報の表示 > JSP フレームワークを使用したテーブルの構築とレンダリング > カスタマイズポイント > 選択可能でない行の設定
  
選択可能でない行の設定
既存の表示列に基づいた選択可能でない行
ブール値を持つ列に応じて選択可能でない行を設定できます。
例:
TableConfig table = factory.newTableConfig ();

//a column that is suppose to hold a boolean
ColumnConfig col1= factory.newColumnConfig (“aBooleanColumn”, false);

table.setNonSelectableColumn (col1);
バッキングオブジェクトで使用可能なブール属性の値に基づいた選択可能でない行の設定
選択可能でない行を設定するため、データユーティリティ com.ptc.core.components.factory.dataUtilities.DefaultBooleanValueDataUtility が事前に用意されています。このデータユーティリティは列 ID "com.ptc.core.components.descriptor.DescriptorConstants.ColumnIdentifiers.NON_SELECTABLE_COLUMN" にマッピングされます。テーブルの列にこのデータユーティリティを設定する方法は 2 とおりあります。
列 ID として NON_SELECTABLE_COL を使用する
ID が "com.ptc.core.components.descriptor.DescriptorConstants.ColumnIdentifiers.NON_SELECTABLE_COLUMN" の列を作成します。必要に応じて属性を設定します。
例:
TableConfig table = factory.newTableConfig ();
ColumnConfig col = factory.newColumnConfig (NON_SELECTABLE_COLUMN, false);
col.setNeed (<Attribute>); // Specify the attribute which will decide the row is
selectable or not.
col.setDataStoreOnly (true); // this will make your Column hidden
table.addComponent (col);
table.setNonSelectableColumn (col);
データユーティリティ ID を NON_SELECTABLE_COLUMN に設定する
任意の ID で列を作成し、必要に応じて属性を設定し、データユーティリティ ID を "com.ptc.core.components.descriptor.DescriptorConstants.ColumnIdentifiers.NON_SELECTABLE_COLUMN" に設定します。
例:
TableConfig table = factory.newTableConfig ();
ColumnConfig col = factory.newColumnConfig(<columnId>, false);
col.setNeed (<Attribute>); // Specify the attribute which will decide the row is
selectable or not.
((JcaColumnConfig)col)setDataUtilityId (NON_SELECTABLE_COLUMN);
col.setDataStoreOnly (true); // this will make your Column hidden
table.addComponent (col);
table.setNonSelectableColumn (col);
カスタムデータユーティリティに基づいた選択可能でない行
選択可能でない列として使用する列のカスタムデータユーティリティを作成して登録します。
カスタムデータユーティリティを作成します
選択可能でない行を制御するカスタムデータユーティリティは "com.ptc.core.components.factory.dataUtilities.AbstractBooleanValueDataUtility" を拡張する必要があります。
getBooleanAttributeValue() メソッドをカスタムロジックによってオーバーライドできます。
例:
package com.customPkg;
import com.ptc.core.components.factory.dataUtilities.
AbstractBooleanValueDataUtility;
public class TestCustomDataUtility extends AbstractNonSelectableRowDataUtility {
public boolean getBooleanAttributeValue (String component_id, Object datum,
ModelContext mc) throws
WTException {
/* this method will return true if the row is not selectable */
}
}
カスタムデータユーティリティを登録します
新規作成したデータユーティリティを列 ID に対して設定します。
<Service name="com.ptc.core.components.descriptor.DataUtility">
<Option serviceClass="com.customPkg.TestCustomDataUtility "
requestor="java.lang.Object" selector="col1” cardinality="duplicate"/>
</Service>
選択可能でない行は次のように表示されます。