return sofaHdr;
}
private void fillCapability(TableTreeItem parent, Capability c) {
// first output language capabilities
TableTreeItem langHdr = createLanguageHeaderGui(parent);
String[] languages = c.getLanguagesSupported();
if (null != languages) {
for (int i = 0; i < languages.length; i++) {
TableTreeItem lItem = new TableTreeItem(langHdr, SWT.NONE);
lItem.setData(LANG_TITLE);
lItem.setText(NAME_COL, languages[i]);
}
}
// second, output Sofas
TableTreeItem sofaHdr = createSofaHeaderGui(parent);
String[] inputSofaNames = c.getInputSofas();
String[] outputSofaNames = c.getOutputSofas();
Arrays.sort(inputSofaNames);
Arrays.sort(outputSofaNames);
for (int i = 0; i < inputSofaNames.length; i++) {
TableTreeItem item = new TableTreeItem(sofaHdr, SWT.NONE);
setGuiSofaName(item, inputSofaNames[i], true);
}
for (int i = 0; i < outputSofaNames.length; i++) {
TableTreeItem item = new TableTreeItem(sofaHdr, SWT.NONE);
setGuiSofaName(item, outputSofaNames[i], false);
}
// scan capability, collecting for each type:
// inputs, outputs, updatesToInputs(features)
// (updatesToInputs are output features without corresponding output type)
// <noFeatures>, or <allFeatures> or feature set
// For each item, generate minimal number of Type items:
TypeCapability tc = null;
FeatureCapability fc;
TypeOrFeature[] inputs = c.getInputs();
TypeOrFeature[] outputs = c.getOutputs();
typeInfo = new TreeMap();
if (null != inputs) {
for (int i = 0; i < inputs.length; i++) {
String name = inputs[i].getName();
if (inputs[i].isType()) {
tc = getTypeCapability(name);
tc.isInputType = true;
if (inputs[i].isAllAnnotatorFeatures()) {
fc = getFeatureCapability(tc, ALL_FEATURES);
fc.isInputFeature = true;
}
} else {
tc = getTypeCapability(getTypeNameFromFullFeatureName(name)); // create a typecapability
// if one doesn't exist
fc = getFeatureCapability(tc, getShortFeatureName(name));
fc.isInputFeature = true;
}
}
}
if (null != outputs) {
for (int i = 0; i < outputs.length; i++) {
String name = outputs[i].getName();
if (outputs[i].isType()) {
tc = getTypeCapability(name);
tc.isOutputType = true;
if (outputs[i].isAllAnnotatorFeatures()) {
fc = getFeatureCapability(tc, ALL_FEATURES);
fc.isOutputType = true;
}
} else {
tc = getTypeCapability(getTypeNameFromFullFeatureName(name));
fc = getFeatureCapability(tc, getShortFeatureName(name));
fc.isOutputUpdate = true;
}
}
}
for (Iterator it = typeInfo.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry) it.next();
String typeName = (String) entry.getKey();
tc = (TypeCapability) entry.getValue();
TableTreeItem item = new TableTreeItem(parent, SWT.NONE);
setGuiTypeName(item, typeName);
if (tc.isInputType)
item.setText(INPUT_COL, INPUT);
if (tc.isOutputType)
item.setText(OUTPUT_COL, OUTPUT);
for (Iterator fit = tc.features.entrySet().iterator(); fit.hasNext();) {
Map.Entry fEntry = (Map.Entry) fit.next();
String featName = (String) fEntry.getKey();
fc = (FeatureCapability) fEntry.getValue();
TableTreeItem fItem = new TableTreeItem(item, SWT.NONE);
fItem.setData(FEAT_TITLE);
fItem.setText(NAME_COL, featName);
if (fc.isInputFeature)
fItem.setText(INPUT_COL, INPUT);
if (fc.isOutputUpdate || fc.isOutputType) {
fItem.setText(OUTPUT_COL, OUTPUT);
}
}
}
}