Author: scooter
Date: 2012-04-11 17:18:11 -0700 (Wed, 11 Apr 2012)
New Revision: 28804
Modified:
core3/api/trunk/group-data-api/src/main/java/org/cytoscape/group/data/CyGroupSettings.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/CyGroupSettingsTask.java
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupViewSettings.java
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/GroupViewCollapseHandler.java
Log:
Group work in progress. I'm not happy with the CyGroupSettings stuff. I think
this API
should go away and be replaced with a simple registration of settings, which
would be
reflected in a CyTable....
Modified:
core3/api/trunk/group-data-api/src/main/java/org/cytoscape/group/data/CyGroupSettings.java
===================================================================
---
core3/api/trunk/group-data-api/src/main/java/org/cytoscape/group/data/CyGroupSettings.java
2012-04-12 00:01:07 UTC (rev 28803)
+++
core3/api/trunk/group-data-api/src/main/java/org/cytoscape/group/data/CyGroupSettings.java
2012-04-12 00:18:11 UTC (rev 28804)
@@ -38,19 +38,27 @@
/**
* CyGroupSettings provides interfaces to access user-requested settings
- * that influence how the {@link CyGroup} system works. There are several
groups
- * of settings that influence different aspects of groups: visual settings,
- * attribute aggregation settings, user interaction settings.
+ * that influence how the {@link CyGroup} system works. There are
+ * two groups of settings that influence different aspects of
+ * groups: visual settings and attribute aggregation settings.
*
* <b>Visual Settings</b>
+ * <ul><li>Double-click action: what should happen when a user double-clicks
+ * on a group node or a group member. This can be either:
+ * <i>None</i>, <i>ExpandContract</i>,
+ * or <i>Select</i>.</li>
+ * <li>Use nested networks: if this setting is set to true, then
+ * when a group is collapsed a nested netwrok will be created for
+ * the group</li>
+ * <li>Hide group node: if this setting is set to true, then
+ * when a group is expanded, the group node is hidden. There are
+ * certain (limited) use cases where a user might want the group node
+ * as well as all member nodes visible in the network at the same
+ * time.</li>
+ * </ul>
*
* <b>Attribute Aggregation Settings</b>
*
- * <b>User Interaction Settings</b>
- * <ul><li>Double-click action: what should happen when a user double-clicks
- * on a group node or a group member. This can be either: <i>None</i>,
<i>ExpandContract</i>,
- * or <i>Select</i>.</li>
- * </ul>
*/
public interface CyGroupSettings {
@@ -65,16 +73,18 @@
}
/**
- * Get the default action to use when the user double-clicks on a group
node or member node.
- * This settings has no impact if Cytoscape is headless.
+ * Get the default action to use when the user double-clicks on a
+ * group node or member node. This setting has no impact if Cytoscape
+ * is headless.
*
* @return the double-click action
*/
public DoubleClickAction getDoubleClickAction();
/**
- * Get the action to use when the user double-clicks a specific group
node or member node.
- * This settings has no impact if Cytoscape is headless.
+ * Get the action to use when the user double-clicks a specific
+ * group node or member node. This setting has no impact if
+ * Cytoscape is headless.
*
* @param group the group we're interested in
* @return the double-click action
@@ -82,16 +92,18 @@
public DoubleClickAction getDoubleClickAction(CyGroup group);
/**
- * Set the default action to use when the user double-clicks on a group
node or member node.
- * This settings has no impact if Cytoscape is headless.
+ * Set the default action to use when the user double-clicks on a
+ * group node or member node. This setting has no impact if
+ * Cytoscape is headless.
*
* @param action the double-click action
*/
public void setDoubleClickAction(DoubleClickAction action);
/**
- * Set the action to use when the user double-clicks on a specific
group node or member node.
- * This settings has no impact if Cytoscape is headless.
+ * Set the action to use when the user double-clicks on a specific
+ * group node or member node. This setting has no impact if
+ * Cytoscape is headless.
*
* @param group the group we're interested in
* @param action the double-click action
@@ -99,16 +111,117 @@
public void setDoubleClickAction(CyGroup group, DoubleClickAction
action);
/**
- * Determine whether attribute aggregation (aggregating all of the
attributes from member nodes
- * onto the group node).
+ * Get the setting controlling whether to visualize a collapsed
+ * group as a nested network.
*
+ * @return the nested network setting
+ */
+ public boolean getUseNestedNetworks();
+
+ /**
+ * Get the setting controlling whether to visualize a specific
+ * collapsed group as a nested network.
+ *
+ * @param group the group we're interested in
+ * @return the nested network setting
+ */
+ public boolean getUseNestedNetworks(CyGroup group);
+
+ /**
+ * Set the setting controlling whether to visualize a collapsed
+ * group as a nested network.
+ *
+ * @param useNN if true, use nested networks to visualize the
+ * collapsed node.
+ */
+ public void setUseNestedNetworks(boolean useNN);
+
+ /**
+ * Set the setting controlling whether to visualize a collapsed
+ * group as a nested network.
+ *
+ * @param group the group we're interested in
+ * @param useNN if true, use nested networks to visualize the
+ * collapsed node.
+ */
+ public void setUseNestedNetworks(CyGroup group, boolean useNN);
+
+ /**
+ * Get the setting controlling whether to hide the
+ * group node when a group is expanded.
+ *
+ * @return the hide group node setting
+ */
+ public boolean getHideGroupNode();
+
+ /**
+ * Get the setting controlling whether to hide the
+ * group node when a specific group is expanded.
+ *
+ * @param group the group we're interested in
+ * @return the hide group node setting
+ */
+ public boolean getHideGroupNode(CyGroup group);
+
+ /**
+ * Set the setting controlling whether to hide the
+ * group node when a group is expanded.
+ *
+ * @param hideGroup the hide group setting
+ */
+ public void setHideGroupNode(boolean hideGroup);
+
+ /**
+ * Set the setting controlling whether to hide the
+ * group node when a group is expanded.
+ *
+ * @param group the group we're interested in
+ * @param hideGroup the hide group setting
+ */
+ public void setHideGroupNode(CyGroup group, boolean hideGroup);
+
+ /**
+ * Get the default opacity of group nodes
+ *
+ * @return opacity as a percentage from 0.0-100.0
+ */
+ public double getGroupNodeOpacity();
+
+ /**
+ * Get the opacity of a particular group node
+ *
+ * @param group the group we're interested in
+ * @return opacity as a percentage from 0.0-100.0
+ */
+ public double getGroupNodeOpacity(CyGroup group);
+
+ /**
+ * Set the default opacity of group nodes
+ *
+ * @param opacity opacity as a percentage from 0.0-100.0
+ */
+ public void setGroupNodeOpacity(double opacity);
+
+ /**
+ * Set the default opacity of a particular group node
+ *
+ * @param group the group we're interested in
+ * @param opacity opacity as a percentage from 0.0-100.0
+ */
+ public void setGroupNodeOpacity(CyGroup group, double opacity);
+
+ /**
+ * Determine whether attribute aggregation (aggregating all of the
+ * attributes from member nodes onto the group node).
+ *
* @return whether attribute aggregation is enabled (true) or not
(false)
*/
public boolean getEnableAttributeAggregation();
/**
- * Determine whether attribute aggregation (aggregating all of the
attributes from member nodes
- * onto the group node) is enabled for a specific group.
+ * Determine whether attribute aggregation (aggregating all of the
+ * attributes from member nodes onto the group node) is enabled for
+ * a specific group.
*
* @param group the group we're interested in
* @return whether attribute aggregation is enabled (true) or not
(false)
@@ -116,21 +229,25 @@
public boolean getEnableAttributeAggregation(CyGroup group);
/**
- * Set whether attribute aggregation (aggregating all of the attributes
from member nodes
- * onto the group node).
+ * Set whether attribute aggregation (aggregating all of the
+ * attributes from member nodes onto the group node).
*
- * @param aggregateAttributes whether attribute aggregation is enabled
(true) or not (false)
+ * @param aggregateAttributes whether attribute aggregation
+ * is enabled (true) or not (false)
*/
public void setEnableAttributeAggregation(boolean aggregateAttributes);
/**
- * Set whether attribute aggregation (aggregating all of the attributes
from member nodes
- * onto the group node) is enabled for a specific group.
+ * Set whether attribute aggregation (aggregating all of the
+ * attributes from member nodes onto the group node) is enabled
+ * for a specific group.
*
* @param group the group we're interested in
- * @param aggregateAttributes whether attribute aggregation is enabled
(true) or not (false)
+ * @param aggregateAttributes whether attribute aggregation is
+ * enabled (true) or not (false)
*/
- public void setEnableAttributeAggregation(CyGroup group, boolean
aggregateAttributes);
+ public void setEnableAttributeAggregation(CyGroup group,
+ boolean aggregateAttributes);
/**
* The the {@link Aggregator} for a specific group and column
@@ -141,16 +258,81 @@
*/
public Aggregator getAggregator(CyGroup group, CyColumn column);
- public void setDefaultAggregation(CyGroup group, Class ovClass, Aggregator
agg);
+ /**
+ * Set the default aggregator to use for a specific group and class.
+ *
+ * @param group the group to set the aggregator for
+ * @param ovClass the Class to set the aggregator for
+ * @param agg the {@link Aggregator} to use
+ */
+ public void setDefaultAggregation(CyGroup group, Class ovClass,
+ Aggregator agg);
+
+ /**
+ * Get the default aggregator to use for a specific group and class.
+ *
+ * @param group the group to get the aggregator for
+ * @param ovClass the Class to get the aggregator for
+ * @return the {@link Aggregator} to use
+ */
public Aggregator getDefaultAggregation(CyGroup group, Class ovClass);
+ /**
+ * Set the default aggregator to use for a class.
+ *
+ * @param ovClass the Class to set the aggregator for
+ * @param agg the {@link Aggregator} to use
+ */
public void setDefaultAggregation(Class ovClass, Aggregator agg);
+
+ /**
+ * Get the default aggregator to use for a class.
+ *
+ * @param ovClass the Class to get the aggregator for
+ * @return the {@link Aggregator} to use
+ */
public Aggregator getDefaultAggregation(Class ovClass);
- public void setOverrideAggregation(CyGroup group, CyColumn column,
Aggregator agg);
+ /**
+ * Set the aggregator to use for a specific group and {@link CyColumn}.
+ * An override aggregator will be use for this node and this column
+ * only, reguardless of what the default aggregation is set to.
+ *
+ * @param group the group to set the override for
+ * @param column the CyColumn to set the override for
+ * @param agg the {@link Aggregator} to use
+ */
+ public void setOverrideAggregation(CyGroup group, CyColumn column,
+ Aggregator agg);
+
+ /**
+ * Get the aggregator to use for a specific group and {@link CyColumn}.
+ * An override aggregator will be use for this node and this column
+ * only, reguardless of what the default aggregation is set to.
+ *
+ * @param group the group to get the override for
+ * @param column the CyColumn to get the override for
+ * @return the {@link Aggregator} to use
+ */
public Aggregator getOverrideAggregation(CyGroup group, CyColumn column);
+ /**
+ * Set the aggregator to use for a {@link CyColumn}.
+ * An override aggregator will be use for this column
+ * only, reguardless of what the default aggregation is set to.
+ *
+ * @param column the CyColumn to set the override for
+ * @param agg the {@link Aggregator} to use
+ */
public void setOverrideAggregation(CyColumn column, Aggregator agg);
+
+ /**
+ * Get the aggregator to use for a specific {@link CyColumn}.
+ * An override aggregator will be use for this column
+ * only, reguardless of what the default aggregation is set to.
+ *
+ * @param column the CyColumn to get the override for
+ * @return the {@link Aggregator} to use
+ */
public Aggregator getOverrideAggregation(CyColumn column);
-
}
Modified:
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
2012-04-12 00:01:07 UTC (rev 28803)
+++
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsImpl.java
2012-04-12 00:18:11 UTC (rev 28804)
@@ -35,8 +35,14 @@
Map<CyGroup, GroupSpecificMaps> groupMap;
Map<CyGroup, DoubleClickAction> groupActionMap;
Map<CyGroup, Boolean> enableMap;
+ Map<CyGroup, Boolean> nestedNetworkMap;
+ Map<CyGroup, Boolean> hideGroupMap;
+ Map<CyGroup, Double> opacityMap;
DoubleClickAction action = DoubleClickAction.ExpandContract;
boolean enableAttributeAggregation = false;
+ boolean useNestedNetworks = false;
+ boolean hideGroupNode = true;
+ double groupNodeOpacity = 100.0;
public CyGroupSettingsImpl(CyGroupManager mgr,
CyGroupAggregationManager aggMgr,
@@ -50,60 +56,142 @@
groupMap = new HashMap<CyGroup,GroupSpecificMaps>();
groupActionMap = new HashMap<CyGroup, DoubleClickAction>();
enableMap = new HashMap<CyGroup, Boolean>();
+ nestedNetworkMap = new HashMap<CyGroup, Boolean>();
+ hideGroupMap = new HashMap<CyGroup, Boolean>();
+ opacityMap = new HashMap<CyGroup, Double>();
}
+
/***************************************************************************
+ * View settings
*
+
**************************************************************************/
+
@Override
- public boolean getEnableAttributeAggregation() {
- return enableAttributeAggregation;
+ public DoubleClickAction getDoubleClickAction() {
+ return action;
}
@Override
- public boolean getEnableAttributeAggregation(CyGroup group) {
- if (enableMap.containsKey(group))
- return enableMap.get(group);
- return enableAttributeAggregation;
+ public DoubleClickAction getDoubleClickAction(CyGroup group) {
+ if (groupActionMap.containsKey(group))
+ return groupActionMap.get(group);
+ return action;
}
@Override
- public void setEnableAttributeAggregation(boolean aggregate) {
- this.enableAttributeAggregation = aggregate;
+ public void setDoubleClickAction(DoubleClickAction action) {
+ this.action = action;
}
@Override
- public void setEnableAttributeAggregation(CyGroup group,
- boolean aggregate) {
+ public void setDoubleClickAction(CyGroup group, DoubleClickAction
action) {
if (group != null)
- enableMap.put(group, aggregate);
+ groupActionMap.put(group, action);
else
- this.enableAttributeAggregation = aggregate;
+ this.action = action;
}
@Override
- public DoubleClickAction getDoubleClickAction() {
- return action;
+ public boolean getUseNestedNetworks() { return useNestedNetworks; }
+
+ @Override
+ public boolean getUseNestedNetworks(CyGroup group) {
+ if (nestedNetworkMap.containsKey(group))
+ return nestedNetworkMap.get(group);
+ return useNestedNetworks;
}
@Override
- public DoubleClickAction getDoubleClickAction(CyGroup group) {
- if (groupActionMap.containsKey(group))
- return groupActionMap.get(group);
- return action;
+ public void setUseNestedNetworks(boolean useNN) {
+ useNestedNetworks = useNN;
}
@Override
- public void setDoubleClickAction(DoubleClickAction action) {
- this.action = action;
+ public void setUseNestedNetworks(CyGroup group, boolean useNN) {
+ if (group != null)
+ nestedNetworkMap.put(group, useNN);
+ else
+ this.useNestedNetworks = useNN;
}
@Override
- public void setDoubleClickAction(CyGroup group, DoubleClickAction
action) {
+ public boolean getHideGroupNode() { return hideGroupNode; }
+
+ @Override
+ public boolean getHideGroupNode(CyGroup group) {
+ if (hideGroupMap.containsKey(group))
+ return hideGroupMap.get(group);
+ return hideGroupNode;
+ }
+
+ @Override
+ public void setHideGroupNode(boolean hideGroup) {
+ hideGroupNode = hideGroup;
+ }
+
+ @Override
+ public void setHideGroupNode(CyGroup group, boolean hideGroup) {
if (group != null)
- groupActionMap.put(group, action);
+ hideGroupMap.put(group, hideGroup);
else
- this.action = action;
+ this.hideGroupNode = hideGroup;
}
@Override
+ public double getGroupNodeOpacity() { return groupNodeOpacity; }
+
+ @Override
+ public double getGroupNodeOpacity(CyGroup group) {
+ if (opacityMap.containsKey(group))
+ return opacityMap.get(group);
+ return groupNodeOpacity;
+ }
+
+ @Override
+ public void setGroupNodeOpacity(double opacity) {
+ groupNodeOpacity = opacity;
+ }
+
+ @Override
+ public void setGroupNodeOpacity(CyGroup group, double opacity) {
+ if (group != null)
+ opacityMap.put(group, opacity);
+ else
+ groupNodeOpacity = opacity;
+ }
+
+
+
+
/***************************************************************************
+ * Aggregation settings
*
+
**************************************************************************/
+
+ @Override
+ public boolean getEnableAttributeAggregation() {
+ return enableAttributeAggregation;
+ }
+
+ @Override
+ public boolean getEnableAttributeAggregation(CyGroup group) {
+ if (enableMap.containsKey(group))
+ return enableMap.get(group);
+ return enableAttributeAggregation;
+ }
+
+ @Override
+ public void setEnableAttributeAggregation(boolean aggregate) {
+ this.enableAttributeAggregation = aggregate;
+ }
+
+ @Override
+ public void setEnableAttributeAggregation(CyGroup group,
+ boolean aggregate) {
+ if (group != null)
+ enableMap.put(group, aggregate);
+ else
+ this.enableAttributeAggregation = aggregate;
+ }
+
+ @Override
public Aggregator getAggregator(CyGroup group, CyColumn column) {
Class type = column.getType();
Map<Class, Aggregator> defaultMap = allGroupDefaultMap;
Modified:
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsTask.java
===================================================================
---
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsTask.java
2012-04-12 00:01:07 UTC (rev 28803)
+++
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupSettingsTask.java
2012-04-12 00:18:11 UTC (rev 28804)
@@ -49,6 +49,9 @@
public void run (TaskMonitor taskMonitor) {
// Update view settings
settings.setDoubleClickAction(group,
viewSettings.getDoubleClickAction());
+ settings.setUseNestedNetworks(group,
viewSettings.getUseNestedNetworks());
+ settings.setHideGroupNode(group,
viewSettings.getHideGroupNode());
+ settings.setGroupNodeOpacity(group,
viewSettings.getGroupNodeOpacity());
// Update aggregation settings (more complicated)
boolean enabled =
aggregationSettings.getAttributeAggregationEnabled();
Modified:
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupViewSettings.java
===================================================================
---
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupViewSettings.java
2012-04-12 00:01:07 UTC (rev 28803)
+++
core3/impl/trunk/group-data-impl/src/main/java/org/cytoscape/group/data/internal/CyGroupViewSettings.java
2012-04-12 00:18:11 UTC (rev 28804)
@@ -6,6 +6,7 @@
import org.cytoscape.work.AbstractTask;
import org.cytoscape.work.TaskMonitor;
import org.cytoscape.work.Tunable;
+import org.cytoscape.work.util.BoundedDouble;
import org.cytoscape.work.util.ListSingleSelection;
import org.cytoscape.group.CyGroup;
@@ -35,13 +36,25 @@
// We need to use getters and setters so we can update
// our settings object
@Tunable(description="Double-Click action",
- groups={"User Action Settings"}/*,
params="displayState=collapse"*/)
+ groups={"Group View Settings","User Action Settings"})
public ListSingleSelection<DoubleClickAction> getDCAction() {
return doubleClickAction;
}
public void setDCAction(ListSingleSelection<DoubleClickAction> input) {
}
+ @Tunable(description="Show collapsed node as a Nested Network",
+ groups={"Group View Settings"})
+ public boolean useNestedNetworks = false;
+
+ @Tunable(description="Hide group node on expand",
+ groups={"Group View Settings"})
+ public boolean hideGroupNode = true;
+
+ @Tunable(description="Opacity of the group node", params="slider=true",
+ groups={"Group View Settings"})
+ public BoundedDouble groupNodeOpacity = new BoundedDouble(0.0, 100.0,
100.0, false, false);
+
public CyGroupViewSettings(CyGroupSettings settings) {
this.settings = settings;
@@ -55,4 +68,16 @@
public DoubleClickAction getDoubleClickAction() {
return doubleClickAction.getSelectedValue();
}
+
+ public boolean getUseNestedNetworks() {
+ return useNestedNetworks;
+ }
+
+ public boolean getHideGroupNode() {
+ return hideGroupNode;
+ }
+
+ public double getGroupNodeOpacity() {
+ return groupNodeOpacity.getValue();
+ }
}
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-04-12 00:01:07 UTC (rev 28803)
+++
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/CyActivator.java
2012-04-12 00:18:11 UTC (rev 28804)
@@ -11,6 +11,7 @@
import org.cytoscape.group.events.GroupCollapsedListener;
import org.cytoscape.model.CyNetworkManager;
import org.cytoscape.task.NodeViewTaskFactory;
+import org.cytoscape.view.model.CyNetworkViewFactory;
import org.cytoscape.view.model.CyNetworkViewManager;
import org.cytoscape.view.vizmap.VisualMappingManager;
@@ -29,12 +30,15 @@
CyEventHelper cyEventHelperServiceRef =
getService(bc,CyEventHelper.class);
CyGroupManager cyGroupManager =
getService(bc,CyGroupManager.class);
CyNetworkViewManager cyNetworkViewManager =
getService(bc,CyNetworkViewManager.class);
+ CyNetworkViewFactory cyNetworkViewFactory =
getService(bc,CyNetworkViewFactory.class);
CyNetworkManager cyNetworkManager =
getService(bc,CyNetworkManager.class);
CyGroupSettings groupSettings =
getService(bc,CyGroupSettings.class);
VisualMappingManager styleManager = getService(bc,
VisualMappingManager.class);
GroupViewCollapseHandler gvcHandler =
- new GroupViewCollapseHandler(cyGroupManager,
cyNetworkViewManager, styleManager);
+ new GroupViewCollapseHandler(cyGroupManager,
groupSettings, cyNetworkManager,
+ cyNetworkViewManager,
cyNetworkViewFactory,
+ styleManager);
registerService(bc,gvcHandler,GroupAboutToCollapseListener.class, new
Properties());
registerService(bc,gvcHandler,GroupCollapsedListener.class, new
Properties());
Modified:
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/GroupViewCollapseHandler.java
===================================================================
---
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/GroupViewCollapseHandler.java
2012-04-12 00:01:07 UTC (rev 28803)
+++
core3/impl/trunk/group-view-impl/src/main/java/org/cytoscape/group/view/internal/GroupViewCollapseHandler.java
2012-04-12 00:18:11 UTC (rev 28804)
@@ -35,18 +35,21 @@
import org.cytoscape.group.CyGroup;
import org.cytoscape.group.CyGroupManager;
+import org.cytoscape.group.data.CyGroupSettings;
import org.cytoscape.group.events.GroupAboutToCollapseEvent;
import org.cytoscape.group.events.GroupAboutToCollapseListener;
import org.cytoscape.group.events.GroupCollapsedEvent;
import org.cytoscape.group.events.GroupCollapsedListener;
import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyNetworkManager;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyRow;
import org.cytoscape.model.CyTable;
import org.cytoscape.model.subnetwork.CyRootNetwork;
import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.view.model.CyNetworkViewFactory;
import org.cytoscape.view.model.CyNetworkViewManager;
import org.cytoscape.view.model.View;
import org.cytoscape.view.model.VisualProperty;
@@ -65,8 +68,11 @@
{
private final CyGroupManager cyGroupManager;
+ private final CyNetworkManager cyNetworkManager;
private final CyNetworkViewManager cyNetworkViewManager;
+ private final CyNetworkViewFactory cyNetworkViewFactory;
private final VisualMappingManager cyStyleManager;
+ private final CyGroupSettings cyGroupSettings;
private static final Logger logger =
LoggerFactory.getLogger(GroupViewCollapseHandler.class);
private static final VisualProperty<Double> xLoc =
BasicVisualLexicon.NODE_X_LOCATION;
private static final VisualProperty<Double> yLoc =
BasicVisualLexicon.NODE_Y_LOCATION;
@@ -81,11 +87,17 @@
* @param cyEventHelper
*/
public GroupViewCollapseHandler(final CyGroupManager groupManager,
+ final CyGroupSettings groupSettings,
+ final CyNetworkManager netManager,
final CyNetworkViewManager viewManager,
+ final CyNetworkViewFactory viewFactory,
final VisualMappingManager
styleManager) {
this.cyGroupManager = groupManager;
+ this.cyGroupSettings = groupSettings;
+ this.cyNetworkManager = netManager;
this.cyNetworkViewManager = viewManager;
this.cyStyleManager = styleManager;
+ this.cyNetworkViewFactory = viewFactory;
}
public void handleEvent(GroupAboutToCollapseEvent e) {
@@ -138,13 +150,32 @@
Dimension d = getLocation(rootNetwork,
group.getGroupNode());
// Move it.
moveNode(view, group.getGroupNode(), d);
+
+ if (cyGroupSettings.getUseNestedNetworks(group)) {
+ // Now, if we're displaying the nested network,
create it....
+
+ /* This isn't working, yet...
+ CyNetwork nn = group.getGroupNetwork();
+ cyNetworkManager.addNetwork(nn);
+ CyNetworkView nnView =
cyNetworkViewFactory.createNetworkView(nn);
+ cyNetworkViewManager.addNetworkView(nnView);
+ // Move the nodes around
+ moveNodes(group, nnView, d);
+ // Apply our visual style
+ viewStyle.apply(nnView);
+ nnView.updateView();
+ */
+ }
+
+ // Handle opacity
+ double opacity =
cyGroupSettings.getGroupNodeOpacity(group);
+
} else {
// Get the location of the group node before it went
away
Dimension center = getLocation(rootNetwork,
group.getGroupNode());
- // Now, get the offsets for each of the member nodes
and move them
- for (CyNode node: group.getNodeList()) {
- Dimension location =
getOffsetLocation(rootNetwork, node, center);
- moveNode(view, node, location);
+ moveNodes(group, view, center);
+ // If we're asked to, show the group node
+ if (!cyGroupSettings.getHideGroupNode(group)) {
}
}
viewStyle.apply(view);
@@ -165,6 +196,14 @@
return getDim(xCenter, yCenter);
}
+ private void moveNodes(CyGroup group, CyNetworkView view, Dimension
center) {
+ CyRootNetwork rootNetwork = group.getRootNetwork();
+ for (CyNode node: group.getNodeList()) {
+ Dimension location = getOffsetLocation(rootNetwork,
node, center);
+ moveNode(view, node, location);
+ }
+ }
+
private Dimension calculateOffset(Dimension center, CyNetworkView view,
CyNode node) {
View<CyNode>nView = view.getNodeView(node);
double xOffset = nView.getVisualProperty(xLoc) -
center.getWidth();
--
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.