use of org.cytoscape.work.util.ListSingleSelection in project cytoscape-impl by cytoscape.
the class ImportTableDataTask method getColumns.
private ListSingleSelection<String> getColumns(final Collection<? extends CyNetwork> networkList, final TableType tableType, final String namespace) {
Set<ColumnDescriptor> colDescSet = null;
// Get set of columns with same name and type that are common to all networks
for (CyNetwork network : networkList) {
final CyTable table = getTable(network, tableType, namespace);
final Set<ColumnDescriptor> subSet = new HashSet<>();
for (CyColumn col : table.getColumns()) {
if (isMappableColumn(col))
subSet.add(new ColumnDescriptor(col.getName(), col.getType()));
}
if (colDescSet == null)
// First network? Just save the mappable columns...
colDescSet = subSet;
else
// From now on just keep the common columns...
colDescSet.retainAll(subSet);
}
final List<String> columnNames = new ArrayList<>();
if (colDescSet != null) {
for (ColumnDescriptor cd : colDescSet) columnNames.add(cd.name);
sort(columnNames);
}
final ListSingleSelection<String> columns = new ListSingleSelection<>(columnNames);
if (columns.getPossibleValues().contains(CyRootNetwork.SHARED_NAME))
columns.setSelectedValue(CyRootNetwork.SHARED_NAME);
return columns;
}
use of org.cytoscape.work.util.ListSingleSelection in project cytoscape-impl by cytoscape.
the class MergeTablesTask method getKeyColumnList.
private ListSingleSelection<String> getKeyColumnList(final CyTable table) {
final List<String> colNames = new ArrayList<>();
for (CyColumn col : table.getColumns()) {
if (isMappableColumn(col)) {
colNames.add(col.getName());
}
}
sort(colNames);
final ListSingleSelection<String> columns = new ListSingleSelection<>(colNames);
if (colNames.contains(CyRootNetwork.NAME))
columns.setSelectedValue(CyRootNetwork.NAME);
else if (!table.getPrimaryKey().getName().matches(CyRootNetwork.SUID) && colNames.contains(table.getPrimaryKey().getName()))
columns.setSelectedValue(table.getPrimaryKey().getName());
return columns;
}
use of org.cytoscape.work.util.ListSingleSelection in project clusterMaker2 by RBVI.
the class BestNeighborContext method setNetwork.
public void setNetwork(CyNetwork network) {
if (this.network != null && this.network.equals(network))
// Nothing to see here....
return;
this.network = network;
List<String> integerColumns = super.getClusterAttributeList(network);
if (integerColumns != null) {
clusterAttribute = new ListSingleSelection(integerColumns);
String defaultAttribute = super.getDefaultAttribute(network);
if (integerColumns.contains(defaultAttribute))
clusterAttribute.setSelectedValue(defaultAttribute);
}
}
use of org.cytoscape.work.util.ListSingleSelection in project clusterMaker2 by RBVI.
the class CuttingEdgeContext method setNetwork.
public void setNetwork(CyNetwork network) {
if (this.network != null && this.network.equals(network))
// Nothing to see here....
return;
this.network = network;
List<String> integerColumns = super.getClusterAttributeList(network);
if (integerColumns != null) {
clusterAttribute = new ListSingleSelection(integerColumns);
String defaultAttribute = super.getDefaultAttribute(network);
if (integerColumns.contains(defaultAttribute))
clusterAttribute.setSelectedValue(defaultAttribute);
}
}
use of org.cytoscape.work.util.ListSingleSelection in project clusterMaker2 by RBVI.
the class DensityContext method setNetwork.
public void setNetwork(CyNetwork network) {
if (this.network != null && this.network.equals(network))
// Nothing to see here....
return;
this.network = network;
List<String> integerColumns = super.getClusterAttributeList(network);
if (integerColumns != null) {
clusterAttribute = new ListSingleSelection(integerColumns);
String defaultAttribute = super.getDefaultAttribute(network);
if (integerColumns.contains(defaultAttribute))
clusterAttribute.setSelectedValue(defaultAttribute);
}
}
Aggregations