Author: mes
Date: 2010-11-12 14:56:50 -0800 (Fri, 12 Nov 2010)
New Revision: 22832
Modified:
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
Log:
added support for unsetting attributes
Modified:
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
===================================================================
---
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
2010-11-12 22:56:07 UTC (rev 22831)
+++
core3/model-impl/trunk/src/main/java/org/cytoscape/model/internal/CyTableImpl.java
2010-11-12 22:56:50 UTC (rev 22832)
@@ -284,8 +284,7 @@
}
private void setX(Object suid, String attrName, Object value) {
- if (value == null)
- throw new NullPointerException("value is null");
+ assert(value!=null);
if (!types.containsKey(attrName) ||
!attributes.containsKey(attrName))
throw new IllegalArgumentException("attribute: '" +
attrName
@@ -304,6 +303,18 @@
+ types.get(attrName));
}
+ private void unSetX(Object suid, String attrName) {
+
+ if (!types.containsKey(attrName) ||
!attributes.containsKey(attrName))
+ throw new IllegalArgumentException("attribute: '" +
attrName
+ + "' does not yet exist!");
+
+ Map<Object, Object> vls = attributes.get(attrName);
+
+ vls.remove(suid);
+ eventHelper.getMicroListener(RowSetMicroListener.class,
getRow(suid)).handleRowSet(attrName,null);
+ }
+
private Object getRawX(Object suid, String attrName) {
Map<Object, Object> vls = attributes.get(attrName);
@@ -416,7 +427,10 @@
}
public void set(String attributeName, Object value) {
- setX(suid, attributeName, value);
+ if ( value == null )
+ unSetX(suid, attributeName);
+ else
+ setX(suid, attributeName, value);
}
public <T> T get(String attributeName, Class<? extends T> c) {
--
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.