Author: pwang
Date: 2009-11-25 14:29:28 -0800 (Wed, 25 Nov 2009)
New Revision: 18582
Added:
coreplugins/trunk/CytoscapeEditor2/images/
coreplugins/trunk/CytoscapeEditor2/images/network.png
Modified:
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditor.java
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditorManager.java
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditorPlugin.java
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/editors/BasicCytoscapeEditor.java
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/editors/DefaultCytoscapeEditor.java
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/event/BasicNetworkEditEventHandler.java
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/impl/BasicCytoShapeEntity.java
Log:
Add support for nested network
Added: coreplugins/trunk/CytoscapeEditor2/images/network.png
===================================================================
(Binary files differ)
Property changes on: coreplugins/trunk/CytoscapeEditor2/images/network.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditor.java
===================================================================
---
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditor.java
2009-11-25 20:15:06 UTC (rev 18581)
+++
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditor.java
2009-11-25 22:29:28 UTC (rev 18582)
@@ -350,6 +350,12 @@
*/
public void setControllingNodeAttribute(String
controllingNodeAttribute);
+
+ public String getControllingNetworkAttribute();
+
+ public void setControllingNetworkAttribute(String
controllingNetworkAttribute);
+
+
/**
*
* @return the network event handler that is associated with this editor
Modified:
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditorManager.java
===================================================================
---
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditorManager.java
2009-11-25 20:15:06 UTC (rev 18581)
+++
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditorManager.java
2009-11-25 22:29:28 UTC (rev 18582)
@@ -215,6 +215,8 @@
*/
public static final String NODE_TYPE = "NODE_TYPE";
+ public static final String NETWORK_TYPE = "NETWORK_TYPE";
+
// MLC 08/06/06 TODO: This should not be here!:
/**
* attribute used for BioPAX-like editor
@@ -246,7 +248,7 @@
// AJK: 12/06/06: flag for "logging" diagnostic output
- private static boolean loggingEnabled = false;
+ private static boolean loggingEnabled = true;
private static CyLogger logger = null;
@@ -369,7 +371,7 @@
*/
public static void register(String editorName) {
register(editorName, "BasicNetworkEventHandler",
CytoscapeEditorManager.NODE_TYPE,
- CytoscapeEditorManager.EDGE_TYPE,
CytoscapeEditorManager.ANY_VISUAL_STYLE);
+ CytoscapeEditorManager.EDGE_TYPE,
CytoscapeEditorManager.NETWORK_TYPE, CytoscapeEditorManager.ANY_VISUAL_STYLE);
}
/**
@@ -385,7 +387,7 @@
*/
public static void register(String editorName, String
networkEditAdapterName) {
register(editorName, networkEditAdapterName,
CytoscapeEditorManager.NODE_TYPE,
- CytoscapeEditorManager.EDGE_TYPE,
CytoscapeEditorManager.ANY_VISUAL_STYLE);
+ CytoscapeEditorManager.EDGE_TYPE,
CytoscapeEditorManager.NETWORK_TYPE, CytoscapeEditorManager.ANY_VISUAL_STYLE);
}
/**
@@ -405,7 +407,7 @@
public static void register(String editorName, String
networkEditAdapterName,
String visualStyleName) {
register(editorName, networkEditAdapterName,
CytoscapeEditorManager.NODE_TYPE,
- CytoscapeEditorManager.EDGE_TYPE, visualStyleName);
+ CytoscapeEditorManager.EDGE_TYPE,
CytoscapeEditorManager.NETWORK_TYPE, visualStyleName);
}
/**
@@ -427,9 +429,9 @@
*
*/
public static void register(String editorName, String
networkEditAdapterName,
- String controllingNodeAttribute, String
controllingEdgeAttribute) {
+ String controllingNodeAttribute, String
controllingEdgeAttribute, String controllingNetworkAttribute) {
register(editorName, networkEditAdapterName,
controllingNodeAttribute,
- controllingEdgeAttribute,
CytoscapeEditorManager.ANY_VISUAL_STYLE);
+ controllingEdgeAttribute, controllingNetworkAttribute,
CytoscapeEditorManager.ANY_VISUAL_STYLE);
}
/**
@@ -454,7 +456,7 @@
*
*/
public static void register(String editorName, String
networkEditAdapterName,
- String controllingNodeAttribute, String
controllingEdgeAttribute,
+ String controllingNodeAttribute, String
controllingEdgeAttribute, String controllingNetworkAttribute,
String visualStyleName) {
// ASSUME: We have been initialized() before register() is ever
called.
logger.debug ("BEGIN CEM.register()");
@@ -471,6 +473,7 @@
+ controllingEdgeAttribute);
cyEditor.setControllingNodeAttribute(controllingNodeAttribute);
cyEditor.setControllingEdgeAttribute(controllingEdgeAttribute);
+
cyEditor.setControllingNetworkAttribute(controllingNetworkAttribute);
CytoscapeEditorManager.log("now controlling attributes
for editor " + cyEditor);
CytoscapeEditorManager.log("are " +
cyEditor.getControllingNodeAttribute() + " and "
+
cyEditor.getControllingEdgeAttribute());
Modified:
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditorPlugin.java
===================================================================
---
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditorPlugin.java
2009-11-25 20:15:06 UTC (rev 18581)
+++
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/CytoscapeEditorPlugin.java
2009-11-25 22:29:28 UTC (rev 18582)
@@ -47,7 +47,6 @@
import cytoscape.CytoscapeInit;
import cytoscape.plugin.CytoscapePlugin;
-
/**
* core plugin for CytoscapeEditor.
*
@@ -123,7 +122,7 @@
"cytoscape.editor.event.PaletteNetworkEditEventHandler",
// AJK: 02/03/06 have Default
editor use current visual
// style
- CytoscapeEditorManager.NODE_TYPE,
CytoscapeEditorManager.EDGE_TYPE,
+ CytoscapeEditorManager.NODE_TYPE,
CytoscapeEditorManager.EDGE_TYPE, CytoscapeEditorManager.NETWORK_TYPE,
CytoscapeEditorManager.ANY_VISUAL_STYLE);
// AJK: 12/09/06 SimpleBioMoleculeEditor deleted
Modified:
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/editors/BasicCytoscapeEditor.java
===================================================================
---
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/editors/BasicCytoscapeEditor.java
2009-11-25 20:15:06 UTC (rev 18581)
+++
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/editors/BasicCytoscapeEditor.java
2009-11-25 22:29:28 UTC (rev 18582)
@@ -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/trunk/CytoscapeEditor2/src/cytoscape/editor/editors/DefaultCytoscapeEditor.java
===================================================================
---
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/editors/DefaultCytoscapeEditor.java
2009-11-25 20:15:06 UTC (rev 18581)
+++
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/editors/DefaultCytoscapeEditor.java
2009-11-25 22:29:28 UTC (rev 18582)
@@ -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/trunk/CytoscapeEditor2/src/cytoscape/editor/event/BasicNetworkEditEventHandler.java
===================================================================
---
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/event/BasicNetworkEditEventHandler.java
2009-11-25 20:15:06 UTC (rev 18581)
+++
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/event/BasicNetworkEditEventHandler.java
2009-11-25 22:29:28 UTC (rev 18582)
@@ -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/trunk/CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
===================================================================
---
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
2009-11-25 20:15:06 UTC (rev 18581)
+++
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/event/PaletteNetworkEditEventHandler.java
2009-11-25 22:29:28 UTC (rev 18582)
@@ -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(getNodeAttributeName(),
getNodeAttributeValue(), 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
Modified:
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/impl/BasicCytoShapeEntity.java
===================================================================
---
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/impl/BasicCytoShapeEntity.java
2009-11-25 20:15:06 UTC (rev 18581)
+++
coreplugins/trunk/CytoscapeEditor2/src/cytoscape/editor/impl/BasicCytoShapeEntity.java
2009-11-25 22:29:28 UTC (rev 18582)
@@ -216,6 +216,12 @@
+ "OR<br>"
+ "CTRL-click on the first node and then<br>"
+ "click on the second node. </html>");
+ } else if (this.attributeName.equals("NETWORK_TYPE")) {
+ _cytoShape.setToolTipText("<html>To create a
nested network<br>"
+ + "drag and drop the
network onto a node<br>"
+
+ "to assign a nested network,<br>"
+
+ "or on the canvas to create a new node and<br>"
+
+ "assign a nested network. </html>");
}
}
--
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.