Search in sources :

Example 6 with ListSingleSelection

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;
}
Also used : CyTable(org.cytoscape.model.CyTable) ListSingleSelection(org.cytoscape.work.util.ListSingleSelection) CyColumn(org.cytoscape.model.CyColumn) ArrayList(java.util.ArrayList) CyNetwork(org.cytoscape.model.CyNetwork) HashSet(java.util.HashSet)

Example 7 with ListSingleSelection

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;
}
Also used : ListSingleSelection(org.cytoscape.work.util.ListSingleSelection) ArrayList(java.util.ArrayList) CyColumn(org.cytoscape.model.CyColumn)

Example 8 with ListSingleSelection

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);
    }
}
Also used : ListSingleSelection(org.cytoscape.work.util.ListSingleSelection)

Example 9 with ListSingleSelection

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);
    }
}
Also used : ListSingleSelection(org.cytoscape.work.util.ListSingleSelection)

Example 10 with ListSingleSelection

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);
    }
}
Also used : ListSingleSelection(org.cytoscape.work.util.ListSingleSelection)

Aggregations

ListSingleSelection (org.cytoscape.work.util.ListSingleSelection)24 ArrayList (java.util.ArrayList)14 CyTable (org.cytoscape.model.CyTable)8 CyColumn (org.cytoscape.model.CyColumn)7 CyNetwork (org.cytoscape.model.CyNetwork)7 ListMultipleSelection (org.cytoscape.work.util.ListMultipleSelection)6 NetworkViewRenderer (org.cytoscape.application.NetworkViewRenderer)5 HashMap (java.util.HashMap)4 TableType (org.cytoscape.task.internal.table.MapTableToNetworkTablesTask.TableType)3 List (java.util.List)2 CyApplicationManager (org.cytoscape.application.CyApplicationManager)2 CyRootNetwork (org.cytoscape.model.subnetwork.CyRootNetwork)2 HashSet (java.util.HashSet)1 JPanel (javax.swing.JPanel)1 EdgeList (org.cytoscape.command.util.EdgeList)1 NodeList (org.cytoscape.command.util.NodeList)1 NoneAggregator (org.cytoscape.group.internal.data.aggregators.NoneAggregator)1 AbstractCyNetworkReader (org.cytoscape.io.read.AbstractCyNetworkReader)1 CyNetworkReader (org.cytoscape.io.read.CyNetworkReader)1 CyRootNetworkManager (org.cytoscape.model.subnetwork.CyRootNetworkManager)1