Author: pwang
Date: 2009-11-24 11:15:51 -0800 (Tue, 24 Nov 2009)
New Revision: 18561
Modified:
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/editors/BasicCytoscapeEditor.java
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/editors/DefaultCytoscapeEditor.java
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/event/BasicNetworkEditEventHandler.java
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
Log:
Add support for nested network
Modified:
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/editors/BasicCytoscapeEditor.java
===================================================================
---
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/editors/BasicCytoscapeEditor.java
2009-11-24 17:25:29 UTC (rev 18560)
+++
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/editors/BasicCytoscapeEditor.java
2009-11-24 19:15:51 UTC (rev 18561)
@@ -155,6 +155,8 @@
*/
private String _controllingEdgeAttribute;
+ private String _controllingNetworkAttribute;
+
/**
*
* the network event handler that is associated with this editor
@@ -810,6 +812,15 @@
_controllingNodeAttribute = controllingNodeAttribute;
}
+
+ public String getControllingNetworkAttribute() {
+ return _controllingNetworkAttribute;
+ }
+
+ public void setControllingNetworkAttribute(String
controllingNetworkAttribute) {
+ _controllingNetworkAttribute = controllingNetworkAttribute;
+ }
+
/**
*
* @return the network event handler that is associated with this editor
Modified:
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/editors/DefaultCytoscapeEditor.java
===================================================================
---
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/editors/DefaultCytoscapeEditor.java
2009-11-24 17:25:29 UTC (rev 18560)
+++
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/editors/DefaultCytoscapeEditor.java
2009-11-24 19:15:51 UTC (rev 18561)
@@ -48,6 +48,7 @@
import java.util.Iterator;
import java.util.List;
+import javax.swing.ImageIcon;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -142,6 +143,7 @@
CytoscapeEditorManager.log("for editor " + this);
generateEdgePaletteEntries(getControllingEdgeAttribute());
generateNodePaletteEntries(getControllingNodeAttribute());
+ generateNetworkPaletteEntries(getControllingNetworkAttribute());
}
protected void generateEdgePaletteEntries(String controllingAttribute) {
@@ -249,6 +251,19 @@
}
}
+
+ protected void generateNetworkPaletteEntries(String
controllingAttribute) {
+
+ javax.swing.ImageIcon icon = new
ImageIcon(getClass().getResource("/network.png"));
+
+ shapePalette.addShape(controllingAttribute,
"DefaultNestedNetwork",
+ new
CytoShapeIcon(icon.getImage()),
+ "Add a Nested
Network",
+ null);
+ }
+
+
+
protected ShapePalette getShapePalette() {
return shapePalette;
}
Modified:
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/event/BasicNetworkEditEventHandler.java
===================================================================
---
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/event/BasicNetworkEditEventHandler.java
2009-11-24 17:25:29 UTC (rev 18560)
+++
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/event/BasicNetworkEditEventHandler.java
2009-11-24 19:15:51 UTC (rev 18561)
@@ -109,6 +109,8 @@
*/
public static final String EDGE_TYPE = "EDGE_TYPE";
+ public static final String NETWORK_TYPE = "NETWORK_TYPE";
+
/**
*
*/
@@ -120,6 +122,12 @@
public static final String DEFAULT_EDGE = "DefaultEdge";
/**
+ *
+ */
+ public static final String DEFAULT_NETWORK = "DefaultNetwork";
+
+
+ /**
* the node that will be dropped
*/
@@ -184,6 +192,16 @@
protected String edgeAttributeName = EDGE_TYPE;
/**
+ * attribute used to set NETWORK_TYPE
+ */
+ protected String networkAttributeName = NETWORK_TYPE;
+
+ /**
+ * value for attribute used in setting NETWORK_TYPE
+ */
+ protected String networkAttributeValue = DEFAULT_NETWORK;
+
+ /**
* value for attribute used in setting EDGE_TYPE
*/
protected String edgeAttributeValue = DEFAULT_EDGE;
@@ -1019,6 +1037,30 @@
}
/**
+ * @return Returns the networkAttributeName.
+ */
+ public String getNetworkAttributeName() {
+ return networkAttributeName;
+ }
+
+ /**
+ * @param networkAttributeName
+ * The networkAttributeName to set.
+ */
+ public void setNetworkAttributeName(String networkAttributeName) {
+ this.networkAttributeName = networkAttributeName;
+ }
+
+ /**
+ * @param edgeAttributeValue
+ * The edgeAttributeValue to set.
+ */
+ public void setNetworkAttributeValue(String networkAttributeValue) {
+ this.networkAttributeValue = networkAttributeValue;
+ }
+
+
+ /**
* @return Returns the nodeAttributeValue.
*/
public String getNodeAttributeValue() {
Modified:
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
===================================================================
---
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
2009-11-24 17:25:29 UTC (rev 18560)
+++
coreplugins/branches/Peng_CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
2009-11-24 19:15:51 UTC (rev 18561)
@@ -42,6 +42,7 @@
import phoebe.PhoebeCanvasDropEvent;
import cytoscape.CyNode;
import cytoscape.Cytoscape;
+import cytoscape.dialogs.SetNestedNetworkDialog;
import cytoscape.editor.CytoscapeEditor;
import cytoscape.editor.CytoscapeEditorManager;
import cytoscape.editor.impl.BasicCytoShapeEntity;
@@ -195,7 +196,10 @@
setEdgeAttributeName(attributeName);
setEdgeAttributeValue(attributeValue);
handleDroppedEdge(attributeName,
attributeValue, location);
- }
+ } else if
(attributeName.equals(get_caller().getControllingNetworkAttribute())){
+ setNetworkAttributeName(attributeName);
+ setNetworkAttributeValue(attributeValue);
+ handleDroppedNetwork(attributeName,
attributeValue, location); }
}
}
@@ -231,7 +235,34 @@
beginEdge(location, targetNode);
}
+ // Support Nested Network
+ protected void handleDroppedNetwork(String attributeName, String
attributeValue, Point location) {
+ //get_caller().addNetwork("network" + counter, attributeName,
attributeValue, location);
+ //counter++;
+ NodeView targetNode =
getCurrentDGraphView().getPickedNodeView(location);
+ if (targetNode == null) {
+ // Create a new Node
+ CyNode newNode = get_caller().addNode("node" + counter,
attributeName, attributeValue, location);
+ counter++;
+
+ // Set a nested network for this newly created node
+ NodeView newNodeView =
Cytoscape.getCurrentNetworkView().getNodeView(newNode);
+
+ if (newNodeView == null){
+ return;
+ }
+ SetNestedNetworkDialog dlg = new
SetNestedNetworkDialog(Cytoscape.getDesktop(), true, newNodeView);
+ dlg.setLocationRelativeTo(Cytoscape.getDesktop());
+ dlg.setVisible(true);
+ }
+ else {
+ SetNestedNetworkDialog dlg = new
SetNestedNetworkDialog(Cytoscape.getDesktop(), true, targetNode);
+ dlg.setLocationRelativeTo(Cytoscape.getDesktop());
+ dlg.setVisible(true);
+ }
+ }
+
/**
* A stub routine that currently just adds a node at the drop position.
In
* theory, the URL can be traversed and the retrieved document parsed to
--
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.