Search in sources :

Example 76 with CyTable

use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.

the class ViewUtil method getParent.

public static CySubNetwork getParent(final CySubNetwork net, final CyServiceRegistrar serviceRegistrar) {
    final CyTable hiddenTable = net.getTable(CyNetwork.class, CyNetwork.HIDDEN_ATTRS);
    final CyRow row = hiddenTable != null ? hiddenTable.getRow(net.getSUID()) : null;
    final Long suid = row != null ? row.get(PARENT_NETWORK_COLUMN, Long.class) : null;
    if (suid != null) {
        final CyNetwork parent = serviceRegistrar.getService(CyNetworkManager.class).getNetwork(suid);
        if (parent instanceof CySubNetwork)
            return (CySubNetwork) parent;
    }
    return null;
}
Also used : CyTable(org.cytoscape.model.CyTable) CyNetworkManager(org.cytoscape.model.CyNetworkManager) CyNetwork(org.cytoscape.model.CyNetwork) CyRow(org.cytoscape.model.CyRow) CySubNetwork(org.cytoscape.model.subnetwork.CySubNetwork)

Example 77 with CyTable

use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.

the class DynamicLayoutMenu method addNodeAttributeMenus.

private void addNodeAttributeMenus(final JMenu parent, final boolean selectedOnly) {
    CyNetwork network = networkRef.get();
    if (network != null) {
        final CyTable nodeAttributes = network.getDefaultNodeTable();
        addAttributeMenus(parent, nodeAttributes, layout.getSupportedNodeAttributeTypes(), selectedOnly);
    }
}
Also used : CyTable(org.cytoscape.model.CyTable) CyNetwork(org.cytoscape.model.CyNetwork)

Example 78 with CyTable

use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.

the class DynamicLayoutMenu method addEdgeAttributeMenus.

private void addEdgeAttributeMenus(final JMenu parent, final boolean selectedOnly) {
    CyNetwork network = networkRef.get();
    if (network != null) {
        final CyTable edgeAttributes = network.getDefaultEdgeTable();
        addAttributeMenus(parent, edgeAttributes, layout.getSupportedEdgeAttributeTypes(), selectedOnly);
    }
}
Also used : CyTable(org.cytoscape.model.CyTable) CyNetwork(org.cytoscape.model.CyNetwork)

Example 79 with CyTable

use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.

the class LayoutSettingsDialog method getAttributeList.

private List<String> getAttributeList(CyNetwork network, Set<Class<?>> allowedNodeAttributeTypes, Set<Class<?>> allowedEdgeAttributeTypes) {
    List<String> attributes = new ArrayList<String>();
    Set<Class<?>> allowedTypes;
    CyTable table;
    if (allowedNodeAttributeTypes.size() > 0) {
        allowedTypes = allowedNodeAttributeTypes;
        table = network.getDefaultNodeTable();
    } else if (allowedEdgeAttributeTypes.size() > 0) {
        allowedTypes = allowedEdgeAttributeTypes;
        table = network.getDefaultEdgeTable();
    } else {
        return attributes;
    }
    for (final CyColumn column : table.getColumns()) {
        if (column.getName().equals(CyNetwork.SELECTED) || column.getName().equals(CyNetwork.SUID))
            continue;
        if (allowedTypes.contains(column.getType())) {
            attributes.add(column.getName());
        }
    }
    Collections.sort(attributes);
    if (attributes.size() > 0)
        attributes.add(0, UNWEIGHTED);
    return attributes;
}
Also used : CyTable(org.cytoscape.model.CyTable) ArrayList(java.util.ArrayList) CyColumn(org.cytoscape.model.CyColumn)

Example 80 with CyTable

use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.

the class LayoutSettingsDialog method hasSelectedNodes.

private boolean hasSelectedNodes(final CyNetworkView view) {
    if (view == null)
        return false;
    final CyNetwork network = view.getModel();
    final CyTable table = network.getDefaultNodeTable();
    return table.countMatchingRows(CyNetwork.SELECTED, Boolean.TRUE) > 0;
}
Also used : CyTable(org.cytoscape.model.CyTable) CyNetwork(org.cytoscape.model.CyNetwork)

Aggregations

CyTable (org.cytoscape.model.CyTable)282 CyNetwork (org.cytoscape.model.CyNetwork)79 CyRow (org.cytoscape.model.CyRow)73 CyColumn (org.cytoscape.model.CyColumn)71 ArrayList (java.util.ArrayList)55 CyNode (org.cytoscape.model.CyNode)43 CyEdge (org.cytoscape.model.CyEdge)35 Test (org.junit.Test)29 List (java.util.List)26 HashMap (java.util.HashMap)24 CyApplicationManager (org.cytoscape.application.CyApplicationManager)19 HashSet (java.util.HashSet)18 CyIdentifiable (org.cytoscape.model.CyIdentifiable)14 CyNetworkView (org.cytoscape.view.model.CyNetworkView)14 CyNetworkTableManager (org.cytoscape.model.CyNetworkTableManager)13 RowSetRecord (org.cytoscape.model.events.RowSetRecord)11 CyRootNetwork (org.cytoscape.model.subnetwork.CyRootNetwork)11 CySubNetwork (org.cytoscape.model.subnetwork.CySubNetwork)11 CyEventHelper (org.cytoscape.event.CyEventHelper)10 CyTableManager (org.cytoscape.model.CyTableManager)10