Windchill のその他の機能 > 製造プロセス管理 > 製品エクスプローラ (PSE) のカスタマイズ > モデルサブクラス処理用の PSE のカスタマイズ
  
モデルサブクラス処理用の PSE のカスタマイズ
目的
カスタムのモデルビジネスオブジェクトはすでに作成済みです。ここでは、モデルサブクラスを完全にサポートするように、PSE をカスタマイズする必要があります。
範囲/適用可能性/前提条件
モデルサブクラスを別に作成してあります。
予測される結果
モデルサブクラスのインスタンスは、デフォルトのモデルオブジェクトと同様に、PSE によって検出され、表示されます。
ソリューション
以下の 3 つの領域に変更を加えます。
LogicalAttributes.xml
PSE テーブルおよびパネル
カスタマイズされたコマンド代理
前提となる知識
この目的を達成するには、次のことを理解している必要があります。
XML ファイルのカスタマイズの管理
RBINFO ファイルのカスタマイズの管理
ソリューションエレメント
エレメント
タイプ
説明
LogicalAttributes.xml
XML ファイル
"論理フォーム" からそれに対応する "外部フォーム" へのモデル属性マッピングを設定するために使用されます。
手順 - モデルサブクラス処理用の PSE のカスタマイズ
このセクションは次のトピックで構成されます。
LogicalAttributes.xml
PSE テーブルおよびパネル
カスタマイズされたコマンド代理
LogicalAttributes.xml
<Windchill>/codebase/LogicalAttributes.xml にある LogicalAttributes.xml ファイルは、"論理フォーム" からそれに対応する "外部フォーム" へのモデル属性マッピングを設定するために使用されます。マッピングは、オブジェクト間の関連付けを表すすべてのモデル属性に対して必要となります。たとえば、WTPart と WTPartMaster との間の参照に関して定義されたエントリは、次のようになります。
<Class name="wt.part.WTPart">
<Property>
<LogicalForm>defaultUnit</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|defaultUnit</ExternalForm>
</Property>
<Property>
<LogicalForm>masterReference</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster</ExternalForm>
</Property>
<Property>
<LogicalForm>name</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|name</ExternalForm>
</Property>
<Property>
<LogicalForm>number</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|number</ExternalForm>
</Property>
<Property>
<LogicalForm>organizationReference</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|organizationReference^WCTYPE|
wt.org.WTOrganization</ExternalForm>
</Property>
<Property>
<LogicalForm>organizationName</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|organizationReference^WCTYPE|
wt.org.WTOrganization~MBA|name</ExternalForm>
</Property>
<Property>
<LogicalForm>usedLineNumber</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|uses@WCTYPE|
wt.part.WTPartUsageLink~MBA|
lineNumber.value</ExternalForm>
</Property>
<Property>
<LogicalForm>usedLink</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
wt.part.WTPartMaster~MBA|uses@WCTYPE|
wt.part.WTPartUsageLink</ExternalForm>
</Property>
</Class>
"ext.cust.CustPart" が wt.part.WTPart を拡張し、"ext.cust.SubPartMaster" が wt.part.WTPartMaster を拡張する例を使用する場合は、<Windchill>/codebase/LogicalAttributesSite.xml という名前のサイト固有のファイルに次のコード行を追加する必要があります。
<Class name="ext.cust.CustPart">
<Property>
<LogicalForm>defaultUnit</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|defaultUnit</ExternalForm>
</Property>
<Property>
<LogicalForm>masterReference</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster</ExternalForm>
</Property>
<Property>
<LogicalForm>name</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|name</ExternalForm>
</Property>
<Property>
<LogicalForm>number</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|number</ExternalForm>
</Property>
<Property>
<LogicalForm>organizationReference</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|organizationReference^WCTYPE|
wt.org.WTOrganization</ExternalForm>
</Property>
<Property>
<LogicalForm>organizationName</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|organizationReference^WCTYPE|
wt.org.WTOrganization~MBA|name</ExternalForm>
</Property>
<LogicalForm>usedLineNumber</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|uses@WCTYPE|
wt.part.WTPartUsageLink~MBA|
lineNumber.value</ExternalForm>
</Property>
<Property>
<LogicalForm>usedLink</LogicalForm>
<ExternalForm>MBA|masterReference^WCTYPE|
ext.cust.SubPartMaster~MBA|uses@WCTYPE|
wt.part.WTPartUsageLink</ExternalForm>
</Property>
</Class>
PSE テーブルおよびパネル
新規のモデル属性を LogicalAttributes.xml ファイルに追加する必要はありませんが、適切な PSE 設定の XML ファイルに追加する必要があります。詳細については、サブタイプ用の PSE のカスタマイズを参照してください。
* 
サブクラスオブジェクトに関してのみ定義された新規のモデル属性を指定する場合は、"wt.part.WTPart" コンテキストで定義された、対応する "AttributeGroup"、"AttributeTable"、または "Table" を適切なサブクラスコンテキストにコピーする必要があります。
リストにする必要があるのは、新規のモデル属性だけです。既存の属性は継承されます。たとえば、name と number は WTPart から継承されます。
継承される属性をサブクラスパネルから除去するには、次のように "<Placement remove="true"/>" を使用します。
<AttributeDefinition id="contextName”>
<Placement remove="true"/>"
</AttributeDefinition>
カスタマイズされたオブジェクトのエレメントグループを追加する場合は、既存のファイルを編集するのではなく、カスタマイズされたすべての変更を別のファイルに挿入するのが賢明です。これらのファイルには、CustomExplorerForTablesAndPanels.xml などの統一性のある名前を付けてください。
"ext.cust.CustPart" が "wt.part.WTPart" を拡張する前述の例を使用する場合は、次の AttributeGroup を "ext.cust.CustPart" の LogicContext の下にコピーします。
<ExplorerElementGroup>
<LogicContext application="ptc.wnc.StructureExplorer"
dataType="wt.part.WTPart"/>
<AttributeGroup id="ptc.wnc.exp.ViewPropertiesPanel" displayMode="view">
<CellDefinition id="number">
<AttributeDefinition attributeId="number"/>
</CellDefinition>
<CellDefinition id="organizationIdentifier">
<AttributeDefinition attributeId="organizationIdentifier"/>
</CellDefinition>
<CellDefinition id="name">
<AttributeDefinition attributeId="name"/>
</CellDefinition>
<CellDefinition id="versionIterationView">
<AttributeDefinition attributeId="versionIterationView"/>
</CellDefinition>
...
</AttributeGroup>
</ElementGroup>
コピー後のコード行は次のようになります。
<ExplorerElementGroup>
<LogicContext application="ptc.wnc.StructureExplorer"
dataType=" ext.cust.CustPart "/>
<AttributeGroup id="ptc.wnc.exp.ViewPropertiesPanel" displayMode="view">
<!-- name and number will inherit from WTPart -->
<!-- adding new modeled attributes here -->
<CellDefinition id="intMBA">
<AttributeDefinition attributeId="intMBA"/>
</CellDefinition>
...
</AttributeGroup>
</ElementGroup>
カスタマイズされたコマンド代理
PSE では、一部の操作を制御するために Command/CommandDelegate マッピングが使用されます。その最も顕著な例は "コピー操作" です。カスタマイズされたクラスを "コピー" するには、適切なコピー代理をサブクラス化する必要があります。"CustPart" の場合は、wt.enterprise.CopyWTPartDelegate のサブクラスであるクラスを作成して、カスタマイズされたモデル属性のコピーを処理する必要があります。
カスタムクラス向けコピー委任の作成
デフォルトのビジネスオブジェクト (部品など) をカスタマイズしてモデルサブクラスを作成する場合は、部品がコピー (または複製) されたときに追加のモデル属性が正しく処理されるように、カスタムコピー代理クラスを作成および設定する必要があります。
このドキュメントでは、単一の文字列属性 "myAttr" を使用して wt.part.WTPart を拡張するカスタム部品クラス "MyPart" という、単純な例に基づいた手順を示します。
コピー委任の作成
図に示すとおり、wt.enterprise.CopyWTPartDelegate を拡張して、その newCopy() メソッドをオーバーライドすることは簡単です。これを行う目的は、任意のカスタム属性、この例の場合は myAttr を処理することです。このメソッドは次のように実装されています。
public final RevisionControlled newCopy( RevisionControlled object
)throws WTException {
//##begin newCopy%461E645C0050f.body preserve=yes
if (object == null) return null;
MyPart new_copy = (MyPart) super.newCopy(object);
MyPart original = (MyPart) object;
String my_attr = original.getMyAttr();
if (my_attr != null) {
try {
new_copy.setMyAttr(original.getMyAttr());
}
catch (WTPropertyVetoException e) {
throw new WTException(e);
}
return new_copy;
//##end newCopy%461E645C0050f.body
}
コピー委任の作成
コピー委任の設定
カスタムのコピー委任 CopyMyPartDelegate を MyPart のコピー委任クラスとして使用するように Windchill で指定するには、設定ファイル <windchill-install-directory>/codebase/wt/enterprise/EnterpriseServerDelegate.properties に次の行を挿入する必要があります。
wt.services/svc/default/wt.enterprise.CopyDelegate/null/<my-
package>.MyPart/0=<mypackage>.
CopyMyPartDelegate/singleton
カスタマイズポイント
ローカライズ可能なラベルおよび列挙のカスタマイズ
各モデルオブジェクトには、オブジェクトの生成時に作成される RBINFO ファイルが関連付けられています。このファイルには、PSE で属性および列のラベルとして使用される、ローカライズされた文字列が保存されています。ラベルを変更する必要がある場合は、それに対応する RBIFNO ファイルを編集します。たとえば、属性 "booleanMBA" のラベルを変更する場合は、ファイル CustPartModelRB.rbInfo で次の行を編集します。
CustPart.booleanMBA.value=New Label for booleanMBA
モデル化された列挙は、PSE でドロップダウンメニューとしてレンダリングされた場合、列挙の内部値が表示します。ドロップダウンメニューに表示されるラベルを変更するには、列挙に対応する RBINFO ファイルを編集する必要があります。たとえば、"apple"、"dog"、"cat" という値を使用して "public final class MyEnum extends EnumeratedType" というクラスを生成した場合に、ドロップダウンメニューの表示値を変更するには、ファイル MyEnumRB.rbInfo を次のように編集します。
# Entry Contents
apple.value=Apples
dog.value=Dogs
cat.value=Cats
その他のリソース
PSE テーブル表示のカスタマイズ