Search in sources :

Example 96 with CyTable

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

the class ListTablesTask method run.

@Override
public void run(final TaskMonitor taskMonitor) {
    Set<CyTable> allTables = cyTableManager.getAllTables(includePrivate);
    tables = new ArrayList<CyTable>();
    String requestedType = type.getSelectedValue();
    String requestedNamespace = getNamespace(namespace);
    for (CyTable table : allTables) {
        if (!requestedType.equals("all")) {
            Class<? extends CyIdentifiable> tableClass = networkTableMgr.getTableType(table);
            if (tableClass != null && !requestedType.equals("unattached")) {
                String strClass = DataUtils.getIdentifiableType(tableClass);
                if (!strClass.equalsIgnoreCase(requestedType))
                    continue;
                if (!requestedNamespace.equalsIgnoreCase(networkTableMgr.getTableNamespace(table)))
                    continue;
            } else if (tableClass != null && requestedType.equals("unattached")) {
                continue;
            }
        }
        taskMonitor.showMessage(TaskMonitor.Level.INFO, "Table " + getTableDescription(table));
        tables.add(table);
    }
}
Also used : CyTable(org.cytoscape.model.CyTable)

Example 97 with CyTable

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

the class CreateEdgeAttributeTask method run.

@Override
public void run(final TaskMonitor taskMonitor) {
    if (network == null)
        network = appMgr.getCurrentNetwork();
    CyTable edgeTable = getNetworkTable(network, CyEdge.class, columnTunable.getNamespace());
    try {
        createColumn(edgeTable, columnTunable.getColumnName(), columnTypeTunable.getColumnType(), columnTypeTunable.getListElementType());
        success = true;
        if (columnTypeTunable.getColumnType() == "list")
            taskMonitor.showMessage(TaskMonitor.Level.INFO, "Created new " + columnTypeTunable.getListElementType() + " list column: " + columnTunable.getColumnName());
        else
            taskMonitor.showMessage(TaskMonitor.Level.INFO, "Created new " + columnTypeTunable.getColumnType() + " column: " + columnTunable.getColumnName());
    } catch (Exception e) {
        taskMonitor.showMessage(TaskMonitor.Level.ERROR, "Unable to create new column: " + e.getMessage());
    }
}
Also used : CyTable(org.cytoscape.model.CyTable)

Example 98 with CyTable

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

the class ListNetworkAttributesTask method run.

@Override
public void run(final TaskMonitor taskMonitor) {
    if (network == null)
        network = appMgr.getCurrentNetwork();
    CyTable networkTable = getNetworkTable(network, CyNetwork.class, namespace);
    columnList = networkTable.getColumns();
    taskMonitor.showMessage(TaskMonitor.Level.INFO, "   Attributes for network " + DataUtils.getNetworkName(network) + ":");
    for (CyColumn column : columnList) {
        if (column.getType().equals(List.class))
            taskMonitor.showMessage(TaskMonitor.Level.INFO, "        " + column.getName() + ": " + DataUtils.getType(column.getListElementType()) + " list");
        else
            taskMonitor.showMessage(TaskMonitor.Level.INFO, "        " + column.getName() + ": " + DataUtils.getType(column.getType()));
    }
}
Also used : CyTable(org.cytoscape.model.CyTable) CyColumn(org.cytoscape.model.CyColumn)

Example 99 with CyTable

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

the class ListNodeAttributesTask method run.

@Override
public void run(final TaskMonitor taskMonitor) {
    if (network == null)
        network = appMgr.getCurrentNetwork();
    CyTable networkTable = getNetworkTable(network, CyNode.class, namespace);
    columnList = networkTable.getColumns();
    taskMonitor.showMessage(TaskMonitor.Level.INFO, "   Node columns for network " + DataUtils.getNetworkName(network) + ":");
    for (CyColumn column : columnList) {
        if (column.getType().equals(List.class))
            taskMonitor.showMessage(TaskMonitor.Level.INFO, "        " + column.getName() + ": " + DataUtils.getType(column.getListElementType()) + " list");
        else
            taskMonitor.showMessage(TaskMonitor.Level.INFO, "        " + column.getName() + ": " + DataUtils.getType(column.getType()));
    }
}
Also used : CyTable(org.cytoscape.model.CyTable) CyColumn(org.cytoscape.model.CyColumn)

Example 100 with CyTable

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

the class MapGlobalToLocalTableTaskFactoryImpl method createTaskIterator.

@Override
public TaskIterator createTaskIterator(CyTable globalTable, Collection<CyTable> localTables) {
    final Map<String, Object> m = new HashMap<String, Object>();
    List<String> localTableTitles = new ArrayList<String>();
    for (CyTable local : localTables) {
        localTableTitles.add(local.getTitle());
    }
    ListMultipleSelection<String> localTablesTunable = new ListMultipleSelection<String>(localTableTitles);
    localTablesTunable.setSelectedValues(localTableTitles);
    m.put("localTables", localTablesTunable);
    return tunableSetter.createTaskIterator(this.createTaskIterator(globalTable), m);
}
Also used : CyTable(org.cytoscape.model.CyTable) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ListMultipleSelection(org.cytoscape.work.util.ListMultipleSelection)

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