Author: scooter
Date: 2012-03-15 01:48:52 -0700 (Thu, 15 Mar 2012)
New Revision: 28550

Added:
   core3/impl/trunk/group-data-impl/
   core3/impl/trunk/group-data-impl/pom.xml
   core3/impl/trunk/group-data-impl/src/
   core3/impl/trunk/group-data-impl/src/main/
   core3/impl/trunk/group-data-impl/src/main/java/
   core3/impl/trunk/group-data-impl/src/main/java/org/
   core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/
   core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/
   core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/
   
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/
   
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyActivator.java
   
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsImpl.java
   
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsTaskFactory.java
Modified:
   
core3/impl/trunk/group-impl/src/main/java/org/cytoscape/group/internal/CyGroupImpl.java
   core3/impl/trunk/group-view-impl/pom.xml
   
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/CyActivator.java
   
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/GroupViewDoubleClickListener.java
Log:
Implementation of group settings and attribute aggregation.


Added: core3/impl/trunk/group-data-impl/pom.xml
===================================================================
--- core3/impl/trunk/group-data-impl/pom.xml                            (rev 0)
+++ core3/impl/trunk/group-data-impl/pom.xml    2012-03-15 08:48:52 UTC (rev 
28550)
@@ -0,0 +1,117 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+       <parent>
+               <groupId>org.cytoscape</groupId>
+               <artifactId>impl-parent</artifactId>
+               <version>3.0.0-alpha8-SNAPSHOT</version>
+       </parent>
+
+  <properties>
+    <bundle.symbolicName>org.cytoscape.group-data-impl</bundle.symbolicName>
+    <bundle.namespace>org.cytoscape.group.data.internal</bundle.namespace>
+  </properties>
+
+       <modelVersion>4.0.0</modelVersion>
+  <groupId>org.cytoscape</groupId>
+  <artifactId>group-data-impl</artifactId>
+
+       <name>${bundle.symbolicName} [${bundle.namespace}]</name>
+
+  <packaging>bundle</packaging>
+
+       <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>${maven-surefire-plugin.version}</version>
+        <configuration>
+          <redirectTestOutputToFile>true</redirectTestOutputToFile>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${maven-bundle-plugin.version}</version>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
+            <Bundle-Version>${project.version}</Bundle-Version>
+                        <Export-Package>!${bundle.namespace}.*</Export-Package>
+                        
<Private-Package>${bundle.namespace}.*</Private-Package>
+                        
<Bundle-Activator>${bundle.namespace}.CyActivator</Bundle-Activator>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+       </build>
+
+       <repositories>
+               <repository>
+                       <id>cytoscape_snapshots</id>
+                       <snapshots>
+                               <enabled>true</enabled>
+                       </snapshots>
+                       <releases>
+                               <enabled>false</enabled>
+                       </releases>
+                       <name>Cytoscape Snapshots</name>
+                       
<url>http://code.cytoscape.org/nexus/content/repositories/snapshots/</url>
+               </repository>
+               <repository>
+                       <id>cytoscape_releases</id>
+                       <snapshots>
+                               <enabled>false</enabled>
+                       </snapshots>
+                       <releases>
+                               <enabled>true</enabled>
+                       </releases>
+                       <name>Cytoscape Releases</name>
+                       
<url>http://code.cytoscape.org/nexus/content/repositories/releases/</url>
+               </repository>
+       </repositories>
+
+       <dependencies>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>group-api</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>group-data-api</artifactId>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>work-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>event-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>model-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>service-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.mockito</groupId>
+                       <artifactId>mockito-all</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>com.googlecode.guava-osgi</groupId>
+                       <artifactId>guava-osgi</artifactId>
+                       <version>9.0.0</version>
+               </dependency>
+       </dependencies>
+</project>
+

Added: 
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyActivator.java
===================================================================
--- 
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyActivator.java
                           (rev 0)
+++ 
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyActivator.java
   2012-03-15 08:48:52 UTC (rev 28550)
@@ -0,0 +1,54 @@
+
+package org.cytoscape.group.data.internal;
+
+import org.cytoscape.event.CyEventHelper;
+import org.cytoscape.group.CyGroupManager;
+import org.cytoscape.group.data.CyGroupSettings;
+import org.cytoscape.group.events.GroupAboutToCollapseListener;
+import org.cytoscape.group.events.GroupAddedListener;
+import org.cytoscape.model.CyNetworkManager;
+import org.cytoscape.service.util.AbstractCyActivator;
+import org.cytoscape.work.TaskFactory;
+
+import org.osgi.framework.BundleContext;
+import java.util.Properties;
+
+
+public class CyActivator extends AbstractCyActivator {
+       public CyActivator() {
+               super();
+       }
+
+       public void start(BundleContext bc) {
+               // Get the generally useful handlers
+               CyEventHelper cyEventHelperServiceRef = 
getService(bc,CyEventHelper.class);
+               CyGroupManager cyGroupManager = 
getService(bc,CyGroupManager.class);
+               CyNetworkManager cyNetworkManager = 
getService(bc,CyNetworkManager.class);
+
+               // Get our Settings object
+               CyGroupSettingsImpl cyGroupSettings = new 
CyGroupSettingsImpl(cyGroupManager);
+
+               // Register our settings menu
+    CyGroupSettingsTaskFactory settingsFactory = new 
CyGroupSettingsTaskFactory(cyGroupSettings);
+
+    Properties settingsProps = new Properties();
+    settingsProps.setProperty("id","settingsFactory");
+    settingsProps.setProperty("preferredMenu","Tools");
+    settingsProps.setProperty("title", "Group Settings...");
+    settingsProps.setProperty("menuGravity","1.0");
+    settingsProps.setProperty("toolBarGravity","3.4");
+    settingsProps.setProperty("inToolBar","false");
+    registerService(bc,settingsFactory,TaskFactory.class, settingsProps);
+
+               // Make the settings available to consumers
+               registerService(bc,cyGroupSettings, CyGroupSettings.class, new 
Properties());
+    registerService(bc,cyGroupSettings, GroupAddedListener.class, new 
Properties());
+
+               GroupDataCollapseHandler gdcHandler =
+      new GroupDataCollapseHandler(cyGroupManager, cyGroupSettings);
+
+    registerService(bc,gdcHandler,GroupAboutToCollapseListener.class, new 
Properties());
+
+       }
+}
+

Added: 
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsImpl.java
===================================================================
--- 
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsImpl.java
                           (rev 0)
+++ 
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsImpl.java
   2012-03-15 08:48:52 UTC (rev 28550)
@@ -0,0 +1,324 @@
+
+package org.cytoscape.group.data.internal;
+
+import org.cytoscape.model.CyColumn;
+
+import org.cytoscape.work.AbstractTask;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.Tunable;
+import org.cytoscape.work.util.ListSingleSelection;
+
+import org.cytoscape.group.CyGroup;
+import org.cytoscape.group.CyGroupManager;
+import org.cytoscape.group.data.Aggregator;
+import org.cytoscape.group.data.AttributeHandlingType;
+import org.cytoscape.group.data.CyGroupSettings;
+import org.cytoscape.group.data.CyGroupSettings.DoubleClickAction;
+import org.cytoscape.group.data.internal.aggregators.*;
+import org.cytoscape.group.events.GroupAddedEvent;
+import org.cytoscape.group.events.GroupAddedListener;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class CyGroupSettingsImpl extends AbstractTask implements 
CyGroupSettings, GroupAddedListener {
+       CyGroupManager cyGroupManager;
+       Map<Class, Aggregator> allGroupDefaultMap;
+       Map<CyColumn, Aggregator> allGroupOverrideMap;
+       Map<CyGroup, GroupSpecificMaps> groupMap;
+
+
+       @Tunable(description="Double-Click action", 
+                groups={"User Action Settings"}/*, 
params="displayState=collapse"*/)
+  public ListSingleSelection<DoubleClickAction> doubleClickAction = 
+               new 
ListSingleSelection<DoubleClickAction>(DoubleClickAction.None,DoubleClickAction.ExpandContract,
+                                                          
DoubleClickAction.Select);
+
+
+       /**********************************
+        * Default aggregation attributes *
+        *********************************/
+       @Tunable(description="Enable attribute aggregation", groups={"Attribute 
Aggregation Settings"})
+       public boolean enableAttributeAggregation = false;
+
+       // Integer
+       @Tunable(description="Integer column aggregation default", 
+                groups={"Attribute Aggregation Settings", "Default 
Aggregation"}, params="displayState=collapsed",
+                dependsOn="enableAttributeAggregation=true")
+  public ListSingleSelection<AttributeHandlingType> 
getIntegerAggregationDefault() {
+               // Get the list of options
+               List<AttributeHandlingType> options = 
Arrays.asList(IntegerAggregator.getSupportedTypes());
+
+               // Create the selection
+               ListSingleSelection<AttributeHandlingType> types = 
+                       new ListSingleSelection<AttributeHandlingType>(options);
+
+               // Initialize it to our default
+               types.setSelectedValue(AttributeHandlingType.AVG);
+               return types;
+       }
+
+       public void 
setIntegerAggregationDefault(ListSingleSelection<AttributeHandlingType> input) {
+               allGroupDefaultMap.put(Integer.class, new 
IntegerAggregator(input.getSelectedValue()));
+       }
+
+       // Long
+       @Tunable(description="Long column aggregation default", 
+                groups={"Attribute Aggregation Settings", "Default 
Aggregation"},
+                dependsOn="enableAttributeAggregation=true")
+  public ListSingleSelection<AttributeHandlingType> 
getLongAggregationDefault() {
+               // Get the list of options
+               List<AttributeHandlingType> options = 
Arrays.asList(LongAggregator.getSupportedTypes());
+
+               // Create the selection
+               ListSingleSelection<AttributeHandlingType> types = 
+                       new ListSingleSelection<AttributeHandlingType>(options);
+
+               // Initialize it to our default
+               types.setSelectedValue(AttributeHandlingType.AVG);
+               return types;
+       }
+
+       public void 
setLongAggregationDefault(ListSingleSelection<AttributeHandlingType> input) {
+               allGroupDefaultMap.put(Long.class, new 
LongAggregator(input.getSelectedValue()));
+       }
+
+       // Float
+       @Tunable(description="Float column aggregation default", 
+                groups={"Attribute Aggregation Settings", "Default 
Aggregation"},
+                dependsOn="enableAttributeAggregation=true")
+  public ListSingleSelection<AttributeHandlingType> 
getFloatAggregationDefault() {
+               // Get the list of options
+               List<AttributeHandlingType> options = 
Arrays.asList(FloatAggregator.getSupportedTypes());
+
+               // Create the selection
+               ListSingleSelection<AttributeHandlingType> types = 
+                       new ListSingleSelection<AttributeHandlingType>(options);
+
+               // Initialize it to our default
+               types.setSelectedValue(AttributeHandlingType.AVG);
+               return types;
+       }
+
+       public void 
setFloatAggregationDefault(ListSingleSelection<AttributeHandlingType> input) {
+               allGroupDefaultMap.put(Float.class, new 
FloatAggregator(input.getSelectedValue()));
+       }
+
+       // Double
+       @Tunable(description="Double column aggregation default", 
+                groups={"Attribute Aggregation Settings", "Default 
Aggregation"},
+                dependsOn="enableAttributeAggregation=true")
+  public ListSingleSelection<AttributeHandlingType> 
getDoubleAggregationDefault() {
+               // Get the list of options
+               List<AttributeHandlingType> options = 
Arrays.asList(DoubleAggregator.getSupportedTypes());
+
+               // Create the selection
+               ListSingleSelection<AttributeHandlingType> types = 
+                       new ListSingleSelection<AttributeHandlingType>(options);
+
+               // Initialize it to our default
+               types.setSelectedValue(AttributeHandlingType.AVG);
+               return types;
+       }
+
+       public void 
setDoubleAggregationDefault(ListSingleSelection<AttributeHandlingType> input) {
+               allGroupDefaultMap.put(Double.class, new 
DoubleAggregator(input.getSelectedValue()));
+       }
+
+
+       // List
+       @Tunable(description="List column aggregation default", 
+                groups={"Attribute Aggregation Settings", "Default 
Aggregation"},
+                dependsOn="enableAttributeAggregation=true")
+  public ListSingleSelection<AttributeHandlingType> 
getListAggregationDefault() {
+               // Get the list of options
+               List<AttributeHandlingType> options = 
Arrays.asList(ListAggregator.getSupportedTypes());
+
+               // Create the selection
+               ListSingleSelection<AttributeHandlingType> types = 
+                       new ListSingleSelection<AttributeHandlingType>(options);
+
+               // Initialize it to our default
+               types.setSelectedValue(AttributeHandlingType.UNIQUE);
+               return types;
+       }
+
+       public void 
setListAggregationDefault(ListSingleSelection<AttributeHandlingType> input) {
+               allGroupDefaultMap.put(List.class, new 
ListAggregator(input.getSelectedValue()));
+       }
+
+       // String
+       @Tunable(description="String column aggregation default", 
+                groups={"Attribute Aggregation Settings", "Default 
Aggregation"},
+                dependsOn="enableAttributeAggregation=true")
+  public ListSingleSelection<AttributeHandlingType> 
getStringAggregationDefault() {
+               // Get the list of options
+               List<AttributeHandlingType> options = 
Arrays.asList(StringAggregator.getSupportedTypes());
+
+               // Create the selection
+               ListSingleSelection<AttributeHandlingType> types = 
+                       new ListSingleSelection<AttributeHandlingType>(options);
+
+               // Initialize it to our default
+               types.setSelectedValue(AttributeHandlingType.TSV);
+               return types;
+       }
+
+       public void 
setStringAggregationDefault(ListSingleSelection<AttributeHandlingType> input) {
+               allGroupDefaultMap.put(String.class, new 
StringAggregator(input.getSelectedValue()));
+       }
+
+       // Boolean
+       @Tunable(description="Boolean column aggregation default", 
+                groups={"Attribute Aggregation Settings", "Default 
Aggregation"},
+                dependsOn="enableAttributeAggregation=true")
+  public ListSingleSelection<AttributeHandlingType> 
getBooleanAggregationDefault() {
+               // Get the list of options
+               List<AttributeHandlingType> options = 
Arrays.asList(BooleanAggregator.getSupportedTypes());
+
+               // Create the selection
+               ListSingleSelection<AttributeHandlingType> types = 
+                       new ListSingleSelection<AttributeHandlingType>(options);
+
+               // Initialize it to our default
+               types.setSelectedValue(AttributeHandlingType.OR);
+               return types;
+       }
+
+       public void 
setBooleanAggregationDefault(ListSingleSelection<AttributeHandlingType> input) {
+               allGroupDefaultMap.put(Boolean.class, new 
BooleanAggregator(input.getSelectedValue()));
+       }
+
+
+       public CyGroupSettingsImpl(CyGroupManager mgr) {
+               this.cyGroupManager = mgr;
+               allGroupDefaultMap = new HashMap<Class,Aggregator>();
+               allGroupOverrideMap = new HashMap<CyColumn,Aggregator>();
+               groupMap = new HashMap<CyGroup,GroupSpecificMaps>();
+
+               // Set some defaults
+               
doubleClickAction.setSelectedValue(DoubleClickAction.ExpandContract);
+
+               // Build the options
+               
+
+               // Initialize the defaults
+               allGroupDefaultMap.put(Boolean.class, new 
BooleanAggregator(AttributeHandlingType.NONE));
+               allGroupDefaultMap.put(Double.class, new 
DoubleAggregator(AttributeHandlingType.AVG));
+               allGroupDefaultMap.put(Long.class, new 
LongAggregator(AttributeHandlingType.NONE));
+               allGroupDefaultMap.put(Integer.class, new 
IntegerAggregator(AttributeHandlingType.SUM));
+               allGroupDefaultMap.put(Float.class, new 
FloatAggregator(AttributeHandlingType.SUM));
+               allGroupDefaultMap.put(String.class, new 
StringAggregator(AttributeHandlingType.MCV));
+               allGroupDefaultMap.put(List.class, new 
ListAggregator(AttributeHandlingType.UNIQUE));
+       }
+
+       // This is a little funky, but we don't really have a task, so we just 
provide the run method
+       // and do nothing
+       public void run (TaskMonitor taskMonitor) {}
+
+       @Override
+       public boolean getEnableAttributeAggregation() {
+               return enableAttributeAggregation;
+       }
+
+       @Override
+       public void setEnableAttributeAggregation(boolean aggregate) {
+               this.enableAttributeAggregation = aggregate;
+       }
+
+       @Override
+       public DoubleClickAction getDoubleClickAction() {
+               return doubleClickAction.getSelectedValue();
+       }
+
+       @Override
+       public void setDoubleClickAction(DoubleClickAction action) {
+               doubleClickAction.setSelectedValue(action);
+       }
+
+       @Override
+       public Aggregator getAggregator(CyGroup group, CyColumn column) {
+               Class type = column.getType();
+               Map<Class, Aggregator> defaultMap = allGroupDefaultMap;
+               Map<CyColumn, Aggregator> overrideMap = allGroupOverrideMap;
+               if (groupMap.containsKey(group)) {
+                       defaultMap = groupMap.get(group).getDefaults();
+                       overrideMap = groupMap.get(group).getOverrides();
+               }
+               if (overrideMap.containsKey(column))
+                       return overrideMap.get(column);
+               return defaultMap.get(column.getType());
+       }
+
+       @Override
+       public void setDefaultAggregation(CyGroup group, Class ovClass, 
Aggregator agg) {
+               if (!groupMap.containsKey(group)) {
+                       groupMap.put(group, new GroupSpecificMaps());
+               }
+               groupMap.get(group).setDefault(ovClass, agg);
+       }
+
+       @Override
+       public void setDefaultAggregation(Class ovClass, Aggregator agg) {
+               allGroupDefaultMap.put(ovClass, agg);
+       }
+
+       @Override
+       public void setOverrideAggregation(CyGroup group, CyColumn column, 
Aggregator agg) {
+               if (!groupMap.containsKey(group)) {
+                       groupMap.put(group, new GroupSpecificMaps());
+               }
+               groupMap.get(group).setOverride(column, agg);
+       }
+
+       @Override
+       public void setOverrideAggregation(CyColumn column, Aggregator agg) {
+               allGroupOverrideMap.put(column, agg);
+       }
+
+       public void handleEvent(GroupAddedEvent e) {
+               CyGroup addedGroup = e.getGroup();
+               Map<Class,Aggregator> defMap = new HashMap<Class, Aggregator>();
+               for (Class cKey: allGroupDefaultMap.keySet())
+                       defMap.put(cKey, allGroupDefaultMap.get(cKey));
+               Map<CyColumn,Aggregator> ovMap = new HashMap<CyColumn, 
Aggregator>();
+               for (CyColumn cKey: allGroupOverrideMap.keySet())
+                       ovMap.put(cKey, allGroupOverrideMap.get(cKey));
+               groupMap.put(addedGroup, new GroupSpecificMaps(defMap, ovMap));
+       }
+
+
+       class GroupSpecificMaps {
+               Map<Class, Aggregator> defMap;
+               Map<CyColumn, Aggregator> ovMap;
+
+               GroupSpecificMaps () {
+                       this.defMap = null;
+                       this.ovMap = null;
+               }
+
+               GroupSpecificMaps (Map<Class, Aggregator> defMap, Map<CyColumn, 
Aggregator> ovMap) {
+                       this.defMap = defMap;
+                       this.ovMap = ovMap;
+               }
+
+               void setDefault(Class ovClass, Aggregator agg) {
+                       if (defMap == null) defMap = new HashMap<Class, 
Aggregator>();
+
+                       defMap.put(ovClass, agg);
+               }
+
+               void setOverride(CyColumn column, Aggregator agg) {
+                       if (ovMap == null) ovMap = new HashMap<CyColumn, 
Aggregator>();
+
+                       ovMap.put(column, agg);
+               }
+
+               Map<Class,Aggregator> getDefaults() {return defMap;}
+               Map<CyColumn,Aggregator> getOverrides() {return ovMap;}
+       }
+
+}

Added: 
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsTaskFactory.java
===================================================================
--- 
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsTaskFactory.java
                            (rev 0)
+++ 
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsTaskFactory.java
    2012-03-15 08:48:52 UTC (rev 28550)
@@ -0,0 +1,18 @@
+package org.cytoscape.group.data.internal;
+
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.TaskIterator;
+
+class CyGroupSettingsTaskFactory implements TaskFactory {
+       CyGroupSettingsImpl settings;
+
+       public CyGroupSettingsTaskFactory(CyGroupSettingsImpl settings) {
+               this.settings = settings;
+       }
+
+       public CyGroupSettingsImpl getSettings() { return settings; }
+
+       public TaskIterator createTaskIterator() {
+               return new TaskIterator(settings);
+       }
+}

Modified: 
core3/impl/trunk/group-impl/src/main/java/org/cytoscape/group/internal/CyGroupImpl.java
===================================================================
--- 
core3/impl/trunk/group-impl/src/main/java/org/cytoscape/group/internal/CyGroupImpl.java
     2012-03-15 08:45:53 UTC (rev 28549)
+++ 
core3/impl/trunk/group-impl/src/main/java/org/cytoscape/group/internal/CyGroupImpl.java
     2012-03-15 08:48:52 UTC (rev 28550)
@@ -438,8 +438,9 @@
                        // if both the edge and the target are available
                        // since the target node might have been part of a
                        // collapsed group
-                       if (subnet.containsNode(e.getSource()) && 
subnet.containsNode(e.getTarget()))
+                       if (subnet.containsNode(e.getSource()) && 
subnet.containsNode(e.getTarget())) {
                                subnet.addEdge(e);
+                       }
                }
 
                collapseSet.remove(net);
@@ -672,7 +673,6 @@
 
        private boolean isIncoming(CyEdge edge) {
                CyNode source = edge.getSource();
-               CyNode target = edge.getTarget();
                if (source.equals(groupNode) || groupNet.containsNode(source))
                        return false;
                return true;

Modified: core3/impl/trunk/group-view-impl/pom.xml
===================================================================
--- core3/impl/trunk/group-view-impl/pom.xml    2012-03-15 08:45:53 UTC (rev 
28549)
+++ core3/impl/trunk/group-view-impl/pom.xml    2012-03-15 08:48:52 UTC (rev 
28550)
@@ -78,6 +78,10 @@
                </dependency>
                <dependency>
                        <groupId>org.cytoscape</groupId>
+                       <artifactId>group-data-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
                        <artifactId>group-api</artifactId>
                        <scope>test</scope>
                        <type>test-jar</type>

Modified: 
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/CyActivator.java
===================================================================
--- 
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/CyActivator.java
   2012-03-15 08:45:53 UTC (rev 28549)
+++ 
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/CyActivator.java
   2012-03-15 08:48:52 UTC (rev 28550)
@@ -6,6 +6,7 @@
 import org.osgi.framework.BundleContext;
 
 import org.cytoscape.group.CyGroupManager;
+import org.cytoscape.group.data.CyGroupSettings;
 import org.cytoscape.group.events.GroupAboutToCollapseListener;
 import org.cytoscape.group.events.GroupCollapsedListener;
 import org.cytoscape.model.CyNetworkManager;
@@ -29,7 +30,8 @@
                CyGroupManager cyGroupManager = 
getService(bc,CyGroupManager.class);
                CyNetworkViewManager cyNetworkViewManager = 
getService(bc,CyNetworkViewManager.class);
                CyNetworkManager cyNetworkManager = 
getService(bc,CyNetworkManager.class);
-               VisualMappingManager styleManager = 
getService(bc,VisualMappingManager.class);
+               CyGroupSettings groupSettings = 
getService(bc,CyGroupSettings.class);
+               VisualMappingManager styleManager = getService(bc, 
VisualMappingManager.class);
 
                GroupViewCollapseHandler gvcHandler = 
                        new GroupViewCollapseHandler(cyGroupManager, 
cyNetworkViewManager, styleManager);
@@ -39,7 +41,7 @@
 
                // Listen for double-click
                GroupViewDoubleClickListener gvsListener =
-                       new GroupViewDoubleClickListener(cyGroupManager, 
cyEventHelperServiceRef, cyNetworkManager, cyNetworkViewManager);
+                       new GroupViewDoubleClickListener(cyGroupManager, 
groupSettings);
 
                Properties doubleClickProperties = new Properties();
                doubleClickProperties.setProperty("preferredAction", "OPEN");

Modified: 
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/GroupViewDoubleClickListener.java
===================================================================
--- 
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/GroupViewDoubleClickListener.java
  2012-03-15 08:45:53 UTC (rev 28549)
+++ 
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/GroupViewDoubleClickListener.java
  2012-03-15 08:48:52 UTC (rev 28550)
@@ -33,9 +33,10 @@
 import java.util.List;
 import java.util.Set;
 
-import org.cytoscape.event.CyEventHelper;
 import org.cytoscape.group.CyGroup;
 import org.cytoscape.group.CyGroupManager;
+import org.cytoscape.group.data.CyGroupSettings;
+import org.cytoscape.group.data.CyGroupSettings.DoubleClickAction;
 import org.cytoscape.model.CyNetwork;
 import org.cytoscape.model.CyNetworkManager;
 import org.cytoscape.model.CyNode;
@@ -44,7 +45,6 @@
 import org.cytoscape.work.AbstractTask;
 import org.cytoscape.work.TaskIterator;
 import org.cytoscape.work.TaskMonitor;
-import org.cytoscape.view.model.CyNetworkViewManager;
 
 /**
  * Handle selection
@@ -52,39 +52,40 @@
 public class GroupViewDoubleClickListener extends AbstractNodeViewTaskFactory
 {
        CyGroupManager cyGroupManager;
-       CyNetworkViewManager cyNetworkViewManager;
-       CyNetworkManager cyNetworkManager;
-       CyEventHelper cyEventHelper;
-       boolean collapseExpand = false;
+       CyGroupSettings cyGroupSettings;
 
        /**
         * 
-        * @param cyEventHelper
+        * 
         */
-       public GroupViewDoubleClickListener(final CyGroupManager groupManager,
-                                         final CyEventHelper cyEventHelper,
-                                         final CyNetworkManager netManager,
-                                         final CyNetworkViewManager 
viewManager) {
+       public GroupViewDoubleClickListener(final CyGroupManager groupManager, 
final CyGroupSettings groupSettings) {
                this.cyGroupManager = groupManager;
-               this.cyNetworkViewManager = viewManager;
-               this.cyNetworkManager = netManager;
-               this.cyEventHelper = cyEventHelper;
+               this.cyGroupSettings = groupSettings;
        }
 
        public TaskIterator createTaskIterator() {
-               if (collapseExpand) {
+               DoubleClickAction action = 
cyGroupSettings.getDoubleClickAction();
+
+               if (action == DoubleClickAction.ExpandContract) {
                        // Collapse/expand: if we double-click on a collapsed 
node, expand it.  
                        // if we double-click on a node that is a member of a 
group, collapse
                        // that group.
                        return new TaskIterator(new CollapseGroupTask());
-               } else {
+               } else if (action == DoubleClickAction.Select) {
                        // Select/deselect: if we double-click on a node that 
is a member of a group
                        // and any member of the group is not selected, select 
all members of that group.  
                        // If all members of the group are selected, deselect 
that group
                        return new TaskIterator(new SelectGroupTask());
-                       
+               } else {
+                       return new TaskIterator(new NullTask());
                }
        }
+
+       class NullTask extends AbstractTask {
+               public void run(TaskMonitor tm) throws Exception {
+                       return;
+               }
+       }
        
        class SelectGroupTask extends AbstractTask {
                public SelectGroupTask() {}

-- 
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.

Reply via email to