@Override public Component getTreeCellRendererComponent( JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { JLabel label = (JLabel) super.getTreeCellRendererComponent( tree, value, selected, expanded, leaf, row, hasFocus); if (value instanceof ResultObject) { ResultObject ro = (ResultObject) value; String name = childNames.get(ro); if (name == null) { name = ro.getName(); } label.setText("<html>" + name + " (<small>" + ro.getSource() + "</small>)</html>"); if (ro instanceof IOObjectCollection) { label.setIcon(expanded ? ICON_FOLDER_OPEN : ICON_FOLDER_CLOSED); } else { Icon resultIcon = ro.getResultIcon(); label.setIcon(resultIcon); } } else if (value instanceof IOObject) { IOObject ioo = (IOObject) value; label.setText(ioo.getClass().getSimpleName()); } return label; }
@Override public void doWork() throws OperatorException { IOObject data = inputPort.getData(IOObject.class); Annotations annotations = data.getAnnotations(); Attribute annotationAttr = AttributeFactory.createAttribute(ANNOTATION_ATTRIBUTE, Ontology.POLYNOMINAL); Attribute valueAttr = AttributeFactory.createAttribute(VALUE_ATTRIBUTE, Ontology.POLYNOMINAL); MemoryExampleTable table = new MemoryExampleTable(annotationAttr, valueAttr); for (String annotation : annotations.getDefinedAnnotationNames()) { double[] rowData = new double[2]; rowData[0] = annotationAttr.getMapping().mapString(annotation); rowData[1] = valueAttr.getMapping().mapString(annotations.getAnnotation(annotation)); table.addDataRow(new DoubleArrayDataRow(rowData)); } ExampleSet exampleSet = table.createExampleSet(); exampleSet.getAttributes().setSpecialAttribute(annotationAttr, Attributes.ID_NAME); outputPort.deliver(data); annotationsOutputPort.deliver(exampleSet); }
public AbstractPrintableIOObjectPanel(IOObject ioObject, String i18NKey) { i18nKey = i18NKey; source = ioObject.getSource(); }