Author: kono
Date: 2009-12-09 18:51:16 -0800 (Wed, 09 Dec 2009)
New Revision: 18716
Modified:
cytoscape/trunk/src/cytoscape/CytoscapeInit.java
cytoscape/trunk/src/cytoscape/data/readers/CytoscapeSessionReader.java
cytoscape/trunk/src/cytoscape/data/webservice/ui/UnifiedNetworkImportDialog.java
cytoscape/trunk/src/cytoscape/view/CytoscapeDesktop.java
cytoscape/trunk/src/cytoscape/visual/ui/VizMapperMainPanel.java
Log:
Fixed lots of redraw-performance problems. Basic idea is that if redraw is not
necessary, do not redraw. This can be checked by comparing current Visual
Style and assigned Visual Style for the current network view.
Modified: cytoscape/trunk/src/cytoscape/CytoscapeInit.java
===================================================================
--- cytoscape/trunk/src/cytoscape/CytoscapeInit.java 2009-12-10 02:45:29 UTC
(rev 18715)
+++ cytoscape/trunk/src/cytoscape/CytoscapeInit.java 2009-12-10 02:51:16 UTC
(rev 18716)
@@ -553,7 +553,7 @@
* Cytoscape.getDesktop().getCyMenus().initCytoPanelMenus();
Add a
* listener that will apply vizmaps every time attributes change
*/
- PropertyChangeListener attsChangeListener = new
PropertyChangeListener() {
+ final PropertyChangeListener attsChangeListener = new
PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent e) {
if
(e.getPropertyName().equals(Cytoscape.ATTRIBUTES_CHANGED)) {
// apply vizmaps
Modified: cytoscape/trunk/src/cytoscape/data/readers/CytoscapeSessionReader.java
===================================================================
--- cytoscape/trunk/src/cytoscape/data/readers/CytoscapeSessionReader.java
2009-12-10 02:45:29 UTC (rev 18715)
+++ cytoscape/trunk/src/cytoscape/data/readers/CytoscapeSessionReader.java
2009-12-10 02:51:16 UTC (rev 18716)
@@ -387,7 +387,8 @@
curView.setVisualStyle(lastVSName);
Cytoscape.getVisualMappingManager().setNetworkView(curView);
Cytoscape.getVisualMappingManager().setVisualStyle(curView.getVisualStyle());
- curView.redrawGraph(false, true);
+ //TODO: is this necessary?
+ //curView.redrawGraph(false, true);
}
Cytoscape.getDesktop().getVizMapperUI().enableListeners(true);
Modified:
cytoscape/trunk/src/cytoscape/data/webservice/ui/UnifiedNetworkImportDialog.java
===================================================================
---
cytoscape/trunk/src/cytoscape/data/webservice/ui/UnifiedNetworkImportDialog.java
2009-12-10 02:45:29 UTC (rev 18715)
+++
cytoscape/trunk/src/cytoscape/data/webservice/ui/UnifiedNetworkImportDialog.java
2009-12-10 02:51:16 UTC (rev 18716)
@@ -503,7 +503,7 @@
});
}
- private void searchButtonActionPerformed(java.awt.event.ActionEvent
evt) {
+ private void searchButtonActionPerformed(final ActionEvent evt) {
selectedClientID = clientNames
.get(datasourceComboBox.getSelectedItem());
@@ -518,18 +518,17 @@
tConfig.setOwner(Cytoscape.getDesktop());
tConfig.displayCloseButton(true);
tConfig.displayCancelButton(true);
- tConfig.displayStatus(true);
- tConfig.setAutoDispose(false);
+ tConfig.displayStatus(false);
+ tConfig.setAutoDispose(true);
// Execute Task in New Thread; pops open JTask Dialog Box.
TaskManager.executeTask(task, tConfig);
logger.info("Network Import from WS Success!");
- dispose();
}
- private void aboutButtonActionPerformed(java.awt.event.ActionEvent evt)
{
- WebServiceClient wsc = WebServiceClientManager
+ private void aboutButtonActionPerformed(ActionEvent evt) {
+ final WebServiceClient<?> wsc = WebServiceClientManager
.getClient(selectedClientID);
final String clientName = wsc.getDisplayName();
final String description = wsc.getDescription();
@@ -548,10 +547,13 @@
* Clear query text field.
*/
private void clearButtonActionPerformed(java.awt.event.ActionEvent evt)
{
+ // Just set empty string for the field.
queryTextPane.setText("");
}
private void cancelButtonActionPerformed(java.awt.event.ActionEvent
evt) {
+ // Do nothing. Just hide this window.
+ queryTextPane.setText("");
dispose();
}
@@ -584,11 +586,10 @@
}
private void setProperty(String clientID) {
- WebServiceClient client =
WebServiceClientManager.getClient(clientID);
+ final WebServiceClient<?> client =
WebServiceClientManager.getClient(clientID);
- if (client == null) {
+ if (client == null)
return;
- }
ModuleProperties props = client.getProps();
List<Tunable> tunables = props.getTunables();
@@ -652,21 +653,20 @@
private javax.swing.JPanel buttonPanel;
private JPanel queryPanel;
private JPanel installPanel;
-
- // private javax.swing.JButton cancelButton;
private javax.swing.JButton clearButton;
private javax.swing.JPanel dataQueryPanel;
-
- // private javax.swing.JComboBox datasourceComboBox;
- // private javax.swing.JLabel datasourceLabel;
private javax.swing.JPanel datasourcePanel;
-
- // private javax.swing.JButton searchButton;
private javax.swing.JLabel titleIconLabel;
private javax.swing.JPanel titlePanel;
- // End of variables declaration
- class WSNetworkImportTask implements Task {
+
+ /**
+ * Task to import network from web service.
+ *
+ * @author kono
+ *
+ */
+ private class WSNetworkImportTask implements Task {
private String serviceName;
private CyWebServiceEvent<String> evt;
private TaskMonitor taskMonitor;
@@ -694,27 +694,23 @@
WebServiceClientManager.getCyWebServiceEventSupport()
.fireCyWebServiceEvent(cancelEvent);
} catch (CyWebServiceException e) {
- // TODO Auto-generated catch block
taskMonitor.setException(e, "Cancel Failed.");
}
}
public void run() {
cancelFlag = false;
- taskMonitor.setStatus("Loading interactions from " +
serviceName);
+ taskMonitor.setStatus("Loading network from " +
serviceName);
taskMonitor.setPercentCompleted(-1);
- // this even will load the file
try {
WebServiceClientManager.getCyWebServiceEventSupport()
.fireCyWebServiceEvent(evt);
} catch (Exception e) {
taskMonitor.setException(e,
"Failed to load network from
web service.");
-
return;
}
-
taskMonitor.setPercentCompleted(100);
taskMonitor.setStatus("Network successfully loaded.");
}
@@ -781,24 +777,10 @@
} else if (evt.getPropertyName().equals(
WSResponseType.DATA_IMPORT_FINISHED.toString())) {
- // If network is empty, just ignore it.
+ // If result is empty, just ignore it.
if (evt.getNewValue() == null)
return;
- // Old value contains optional parameter
- final Object options = evt.getOldValue();
-
- String[] message = { "Network loaded.",
- "Please enter name for new network:" };
- String value =
JOptionPane.showInputDialog(Cytoscape.getDesktop(),
- message, "Name new network",
JOptionPane.QUESTION_MESSAGE);
- if (value == null || value.length() == 0)
- value = selectedClientID + " Network";
-
- final CyNetwork cyNetwork =
Cytoscape.getCurrentNetwork();
- Cytoscape.getCurrentNetwork().setTitle(value);
-
Cytoscape.getDesktop().getNetworkPanel().updateTitle(cyNetwork);
-
VisualStyle style = ((NetworkImportWebServiceClient)
WebServiceClientManager
.getClient(selectedClientID)).getDefaultVisualStyle();
if (style == null) {
@@ -811,6 +793,18 @@
.addVisualStyle(style);
Cytoscape.getVisualMappingManager().setVisualStyle(style);
+
+ // Name the network
+ final String[] message = { "Network Loaded from " +
selectedClientID,
+ "Please enter title for new network:" };
+ String value =
JOptionPane.showInputDialog(Cytoscape.getDesktop(),
+ message, "Name new network",
JOptionPane.QUESTION_MESSAGE);
+ if (value == null || value.length() == 0)
+ value = selectedClientID + " Network";
+
+ final CyNetwork cyNetwork =
Cytoscape.getCurrentNetwork();
+ Cytoscape.getCurrentNetwork().setTitle(value);
+
Cytoscape.getDesktop().getNetworkPanel().updateTitle(cyNetwork);
}
}
}
Modified: cytoscape/trunk/src/cytoscape/view/CytoscapeDesktop.java
===================================================================
--- cytoscape/trunk/src/cytoscape/view/CytoscapeDesktop.java 2009-12-10
02:45:29 UTC (rev 18715)
+++ cytoscape/trunk/src/cytoscape/view/CytoscapeDesktop.java 2009-12-10
02:51:16 UTC (rev 18716)
@@ -503,8 +503,13 @@
if (new_style.getName().equals(old_style.getName()) ==
false) {
vmm.setVisualStyle(new_style);
- // Is this necessary?
-
Cytoscape.getCurrentNetworkView().redrawGraph(false, true);
+ // Redraw Graph only when current network
view's style is not equal to the selected style.
+ final CyNetworkView curView =
Cytoscape.getCurrentNetworkView();
+ final VisualStyle curViewStyle =
curView.getVisualStyle();
+ if (curView != Cytoscape.getNullNetworkView()
&& curViewStyle != null) {
+ if
(new_style.getName().equals(curViewStyle.getName()) == false)
+
Cytoscape.getCurrentNetworkView().redrawGraph(false, true);
+ }
}
}
}
Modified: cytoscape/trunk/src/cytoscape/visual/ui/VizMapperMainPanel.java
===================================================================
--- cytoscape/trunk/src/cytoscape/visual/ui/VizMapperMainPanel.java
2009-12-10 02:45:29 UTC (rev 18715)
+++ cytoscape/trunk/src/cytoscape/visual/ui/VizMapperMainPanel.java
2009-12-10 02:51:16 UTC (rev 18716)
@@ -781,9 +781,11 @@
// End of variables declaration
private void vsNameComboBoxActionPerformed(java.awt.event.ActionEvent
evt) {
final String vsName = (String) vsNameComboBox.getSelectedItem();
-
+ final CyNetworkView currentView =
Cytoscape.getCurrentNetworkView();
+
if (vsName != null) {
- if
(Cytoscape.getCurrentNetworkView().equals(Cytoscape.getNullNetworkView())) {
+ if (currentView.equals(Cytoscape.getNullNetworkView())
||
+ vsName.equals(lastVSName) ||
currentView.getVisualStyle().getName().equals(vsName)) {
switchVS(vsName, false);
} else {
switchVS(vsName, true);
@@ -928,7 +930,7 @@
vmm.setNetworkView(Cytoscape.getCurrentNetworkView());
// Switch back to the original style.
- switchVS(style.getName());
+ switchVS(style.getName(), false);
// Sync check box and actual lock state
switchNodeSizeLock(lockSize.isSelected());
@@ -1970,7 +1972,7 @@
lastVSName = null;
initVizmapperGUI();
- switchVS(vsName);
+ switchVS(vsName, false);
vsNameComboBox.setSelectedItem(vsName);
vmm.setVisualStyle(vsName);
@@ -1983,7 +1985,8 @@
vmm.setNetworkView(Cytoscape.getCurrentNetworkView());
if
(vs.getName().equals(vsNameComboBox.getSelectedItem())) {
-
Cytoscape.getCurrentNetworkView().redrawGraph(false, true);
+ //TODO: is this necessary?
+
//Cytoscape.getCurrentNetworkView().redrawGraph(false, true);
} else {
switchVS(vs.getName(), false);
vsNameComboBox.setSelectedItem(vs.getName());
--
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.