use of org.cytoscape.tableimport.internal.util.AttributeDataType in project cytoscape-impl by cytoscape.
the class AttributeEditorPanel method updateDataTypeButtons.
private void updateDataTypeButtons() {
final SourceColumnSemantic type = getAttributeType();
for (Entry<AttributeDataType, JToggleButton> entry : dataTypeButtons.entrySet()) {
final AttributeDataType dataType = entry.getKey();
final JToggleButton btn = entry.getValue();
btn.setEnabled(TypeUtil.isValid(type, dataType));
}
}
use of org.cytoscape.tableimport.internal.util.AttributeDataType in project cytoscape-impl by cytoscape.
the class ImportAttributeTableReaderTask method loadAnnotation.
private void loadAnnotation(TaskMonitor tm) {
tm.setProgress(0.0);
final TextTableReader reader = this.reader;
final AttributeMappingParameters readerAMP = (AttributeMappingParameters) reader.getMappingParameter();
final String primaryKey = readerAMP.getAttributeNames()[readerAMP.getKeyIndex()];
final AttributeDataType dataType = readerAMP.getDataTypes()[readerAMP.getKeyIndex()];
final Class<?> keyType;
switch(dataType) {
case TYPE_INTEGER:
keyType = Integer.class;
break;
case TYPE_LONG:
keyType = Long.class;
break;
default:
keyType = String.class;
}
tm.setProgress(0.1);
final CyTable table = serviceRegistrar.getService(CyTableFactory.class).createTable("AttrTable " + inputName.substring(inputName.lastIndexOf('/') + 1) + " " + Integer.toString(numImports++), primaryKey, keyType, true, true);
cyTables = new CyTable[] { table };
tm.setProgress(0.3);
try {
this.reader.readTable(table);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tm.setProgress(1.0);
}
Aggregations