Adding new columns to the table

It is possible to add custom attributes as new columns in a table component, as illustrated by the following code sample.

How to add columns to a table

// Create a datasource
IltDefaultDataSource dataSource = new IltDefaultDataSource();
// Read an XML file into the datasource
dataSource.parse("alarms.xml");
// Create a table component
IlpTable tableComponent = new IlpTable();
// Get the Alarm class
IlpClass alarmClass =
  IltSystem.GetDefaultContext().getClassManager().getClass("Alarm");
// Set the datasource to the component, and show instances 
// of the Alarm class
tableComponent.setDataSource(dataSource, alarmClass);
// Add custom attributes
// Get the existing severity attribute
IlpAttribute severity = alarmClass.getAttribute("perceivedSeverity");
// Create a 'Short severity' attribute that represents the severity 
// in a concise way
IlpAttribute shortSeverityAttribute = 
  new IlpReferenceAttribute("shortSeverity", severity);
tableComponent.addAttribute(shortSeverityAttribute);