Author: mes
Date: 2010-09-07 09:24:45 -0700 (Tue, 07 Sep 2010)
New Revision: 21719
Modified:
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyDataTableImpl.java
Log:
now properly creating the primary key column
Modified:
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyDataTableImpl.java
===================================================================
---
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyDataTableImpl.java
2010-09-07 15:02:03 UTC (rev 21718)
+++
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyDataTableImpl.java
2010-09-07 16:24:45 UTC (rev 21719)
@@ -69,7 +69,10 @@
// Unique ID.
private final long suid;
+ // name of the primary key column
private final String primaryKey;
+
+ // type of the primary key column
private final Class<?> primaryKeyType;
private final CyEventHelper eventHelper;
@@ -84,19 +87,24 @@
* @param pub
* DOCUMENT ME!
*/
- public CyDataTableImpl(String title, String primaryKey, Class<?>
primaryKeyType,
+ public CyDataTableImpl(String title, String primaryKey, Class<?>
pkType,
boolean pub, final CyEventHelper eventHelper) {
this.title = title;
this.primaryKey = primaryKey;
- this.primaryKeyType = primaryKeyType;
+ this.primaryKeyType = getClass(pkType);
this.pub = pub;
this.suid = SUIDFactory.getNextSUID();
this.eventHelper = eventHelper;
attributes = new HashMap<String, Map<Object, Object>>();
rows = new HashMap<Object, CyRow>();
types = new HashMap<String, Class<?>>();
- types.put(primaryKey,primaryKeyType);
unique = new HashMap<String, Boolean>();
+
+ // Create the primary key column. Do this explicitly
+ // so that we don't fire an event.
+ types.put(primaryKey, primaryKeyType);
+ attributes.put(primaryKey, new HashMap<Object, Object>());
+ unique.put(primaryKey, true);
}
/**
@@ -382,6 +390,8 @@
return List.class;
else if (Map.class.isAssignableFrom(c))
return Map.class;
+ else if (Long.class.isAssignableFrom(c))
+ return Long.class;
else
throw new IllegalArgumentException("invalid class: " +
c.getName());
}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.