use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class JoinTablesTaskTest method createTable.
private final CyTable createTable(String col, String listCol) {
CyTable table1 = new CyTableImpl("dummy table", "ID", String.class, true, true, SavePolicy.DO_NOT_SAVE, eventHelper, ColumnDataFactory.createDefaultFactory(), new InterpreterImpl(), 2);
table1.createColumn(col, String.class, false);
CyRow row1 = table1.getRow(node1Name);
row1.set(col, "col1 row1");
CyRow row2 = table1.getRow(node2Name);
row2.set(col, "col1 row2");
List<String> s = new ArrayList<String>();
s.add("listRow1-1");
s.add("listRow1-2");
List<String> s2 = new ArrayList<String>();
s2.add("listRow2-1");
s2.add("listRow2-2");
table1.createListColumn(listCol, String.class, false);
CyRow listRow1 = table1.getRow(node1Name);
listRow1.set(listCol, s);
CyRow listRow2 = table1.getRow(node2Name);
listRow2.set(listCol, s2);
return table1;
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class JoinTablesTaskTest method testJoinTableToSubNetwork.
@Test
public void testJoinTableToSubNetwork() throws Exception {
stm.addTunableHandlerFactory(syncTunableHandlerFactory, syncFactoryProp);
creatNetwork();
final CyTable table2 = createTable("col2", "listCol2");
join(table2, net1, null, net1.getDefaultNodeTable().getColumn(CyNetwork.NAME), true);
testJoinTableToSubNetworkColumns();
testJoinTableToSubNetworkListColumns();
testSubnetworkAfterJointoSub();
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class CyGroupImpl method updateCountAttributes.
public void updateCountAttributes(CyNetwork net) {
CyTable nodeTable = net.getDefaultNodeTable();
CyColumn childrenColumn = nodeTable.getColumn(CHILDREN_ATTR);
if (childrenColumn == null) {
nodeTable.createColumn(CHILDREN_ATTR, Integer.class, true);
}
if (!nodeTable.rowExists(groupNode.getSUID())) {
// Shouldn't happen!
return;
}
CyRow groupRow = nodeTable.getRow(groupNode.getSUID());
// Fix up the NAME
if (neverCollapsed) {
groupRow.set(CyNetwork.NAME, groupRow.get(CyRootNetwork.SHARED_NAME, String.class));
neverCollapsed = false;
}
groupRow.set(CHILDREN_ATTR, getGroupNetwork().getNodeCount());
CyColumn descendentsColumn = nodeTable.getColumn(DESCENDENTS_ATTR);
if (descendentsColumn == null) {
nodeTable.createColumn(DESCENDENTS_ATTR, Integer.class, true);
}
int nDescendents = getGroupNetwork().getNodeCount();
for (CyNode node : getGroupNetwork().getNodeList()) {
if (mgr.isGroup(node, rootNetwork)) {
Integer d = nodeTable.getRow(node.getSUID()).get(DESCENDENTS_ATTR, Integer.class);
if (d != null)
nDescendents += d.intValue();
}
}
groupRow.set(DESCENDENTS_ATTR, nDescendents);
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class ViewUtils method getLocation.
/**
* Get the saved location of the group node
*/
public static Dimension getLocation(CyNetwork network, CyGroup group) {
CyNetwork groupNetwork = group.getGroupNetwork();
CyTable netTable = groupNetwork.getTable(CyNetwork.class, CyNetwork.HIDDEN_ATTRS);
Dimension dim = getNodeLocation(netTable, network, groupNetwork.getSUID());
// System.out.println("Group node should be at: "+dim);
return dim;
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class ViewUtils method updateNodeOffset.
public static void updateNodeOffset(CyNetwork network, CyGroup group, CyNode node, Dimension offset) {
CyTable nodeTable = group.getGroupNetwork().getTable(CyNode.class, CyNetwork.HIDDEN_ATTRS);
updateNodeLocation(nodeTable, network, node.getSUID(), offset);
}
Aggregations