Personnalisation avancée > Business Logic Customization > Customizing Change Management > Addition of Attributes on Links in Change Relationship Table > In-line Editing Attributes on the Links of Change Relationship Tables > Customization Procedure > Custom Table Views (Step 1)
  
Custom Table Views (Step 1)
1. Extend one of the out-of-the-box Table View classes:
Table
View Class
Change Object
Affected Objects
ChangeTaskAffectedItemsTableViews
VarianceAffectedDataTableViews
AffectedDataTableViews
Change Task
Variance
Problem Report and Change Request
Resulting Objects
ChangeTaskResultingItemsTableViews
Change Task
2. Override the getSpecialTableColumnsAttrDefinition() method to include the new attributes.
3. Add the column to all views or only to selected views.
To add the column to all views, override the method getDefaultColumns() and insert the column in the appropriate location.
To add a column to selected views override the method getOOTBTableViews() first calling the super.getOOTBTableViews(), find the view(s) needed to be updated and update those views by changing the TableColumnDefinitions.
4. Add an entry for registering a custom table view against a respective table id in a custom service property xconf file as follows:
<Service context="default"
name="com.ptc.core.htmlcomp.tableview.ConfigurableTable">
<Option
serviceClass="tableViews.custom.DistributingChangeTaskAffectedItemsTableViews"
selector="changeTask_affectedItems_table"
requestor="java.lang.Object"/>
</Service>

For more information on how to add the custom service provider property file, see Adding a Custom Service Provider Property File.
5. Propagate the created xconf files as shown below:
For example, if you have created CustomTableView.xconf and CustomTableView-service.properties.xconf files at the location codebase/ext/custom/, then execute the below command to propagate the xconf files:
xconfmanager -i codebase/ext/custom/CustomTableView.xconf -p
xconfmanager -i codebase/ext/custom/CustomTableView-service.properties.xconf -p
For the content of both the files, refer the following:
For the CustomTableView.xconf file:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Configuration SYSTEM "xconf.dtd">
<Configuration targetFile="codebase/wt.properties">
<!-- Ensure that the file ext/custom/CustomTableView-service.properties.xconf
is appended to the list of custom property files. -->
<Property default="ext/custom/CustomTableView-service.properties.xconf"
name="wt.services.applicationcontext.WTServiceProviderFromProperties.
customPropertyFiles"/>
</Configuration>
For the CustomTableView-service.properties.xconf file:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Configuration SYSTEM "xconf.dtd">
<Configuration targetFile="codebase/service.properties">



<Service context="default"
name="com.ptc.core.htmlcomp.tableview.ConfigurableTable">
<Option
serviceClass="tableViews.custom.DistributingChangeTaskAffectedItemsTableViews"
selector="changeTask_affectedItems_table"
requestor="java.lang.Object"/>
</Service>
</Configuration>
Sample Code

public class DistributingResultingItemsTableViews extends
ChangeTaskResultingItemsTableViews {

/**
* The distributionList will only be added to the Parts and All views
immediately after
* the name column.
*/
@SuppressWarnings("unchecked")
@Override
public List getOOTBTableViews(String tableId, Locale locale)
throws WTException
{
List<TableViewDescriptor> result =
super.getOOTBTableViews(tableId, locale);
for(TableViewDescriptor descriptor: result) {
if( descriptor.getName().equals(PARTS_VIEW) ||
descriptor.getName()
.equals(ALL_VIEW)) {
Vector<ableColumnDefinition> columns =
descriptor.getTableColumnDefinition();
for(int c = 0; c < columns.size(); c++) {
if( "name".equals(columns.get(c).getName())) {
String key = DistributingChangeRecordConstants.
DISTRIBUTION_ATTRIBUTE;
columns.add(c++,TableColumnDefinition.
newTableColumnDefinition
(key,isColumnLocked(key)));
break;
}
}
}
}
return result;
}

@Override
@SuppressWarnings("unchecked")
public List<?> getSpecialTableColumnsAttrDefinition(Locale locale) {
List<Attribute.TextAttribute> results = (List<TextAttribute>)
super.getSpecialTableColumnsAttrDefinition(locale);
results.add(new Attribute.TextAttribute
(DistributingChangeRecordConstants.
DISTRIBUTION_ATTRIBUTE,
"Distribution List" /*Should be localized label*/, locale));
return results;
}
}