Author: rozagh
Date: 2012-04-12 15:20:22 -0700 (Thu, 12 Apr 2012)
New Revision: 28811
Modified:
core3/impl/trunk/filter-impl/src/main/java/org/cytoscape/filter/internal/filters/view/FilterMainPanel.java
core3/impl/trunk/filter-impl/src/main/java/org/cytoscape/filter/internal/widgets/autocomplete/view/TextIndexComboBox.java
Log:
fixes #848 the code for the the initial indexing was commented out for
performance issues. It may cause some performance hits depending on the number
and size of networks and the threads running. Currently since the handling
event for current network change is invoked in another thread it does not cause
the other parts of application to wait for the initiation.
The handleAttributesChanged is also called in the network focus changed handler
to update the attributes combobox based on the current network for adding
different widgets. The column name changed listener is also extended and
handled to update the attributes combobox if a column's name is changed.
However, it is possible to have a widget already added for the renamed column
in this case the filter will not be effective since the column does not exist
anymore.
Modified:
core3/impl/trunk/filter-impl/src/main/java/org/cytoscape/filter/internal/filters/view/FilterMainPanel.java
===================================================================
---
core3/impl/trunk/filter-impl/src/main/java/org/cytoscape/filter/internal/filters/view/FilterMainPanel.java
2012-04-12 21:09:32 UTC (rev 28810)
+++
core3/impl/trunk/filter-impl/src/main/java/org/cytoscape/filter/internal/filters/view/FilterMainPanel.java
2012-04-12 22:20:22 UTC (rev 28811)
@@ -88,6 +88,8 @@
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNetworkManager;
import org.cytoscape.model.CyIdentifiable;
+import org.cytoscape.model.events.ColumnNameChangedEvent;
+import org.cytoscape.model.events.ColumnNameChangedListener;
import org.cytoscape.model.events.NetworkAboutToBeDestroyedEvent;
import org.cytoscape.model.events.NetworkAboutToBeDestroyedListener;
import org.cytoscape.model.events.NetworkAddedEvent;
@@ -102,17 +104,19 @@
import org.cytoscape.util.swing.DropDownMenuButton;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.work.TaskManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-
@SuppressWarnings("serial")
public class FilterMainPanel extends JPanel implements ActionListener,
ItemListener,
SetCurrentNetworkListener, NetworkAddedListener,
-
NetworkAboutToBeDestroyedListener, SessionLoadedListener, RowsSetListener,
+
NetworkAboutToBeDestroyedListener, SessionLoadedListener,
RowsSetListener,ColumnNameChangedListener,
RowsCreatedListener,
FiltersChangedListener {
// String constants used for separator entries in the attribute combobox
private static final String filtersSeparator = "-- Filters --";
private static final String attributesSeperator = "-- Attributes --";
+ private static final Logger logger =
LoggerFactory.getLogger(FilterMainPanel.class);
private final QuickFind quickFind;
@@ -252,10 +256,14 @@
return;
}
- // If FilterPanel is not selected, do nothing
+ //TODO The current panel check is incorrect.
+
+ // If FilterPanel is not selected, do nothing
==> ****** ERR this is incorrect *******
if (cmbFilters.getSelectedItem() == null) {
return;
}
+
+ handleAttributesChanged();
//Refresh indices for UI widgets after network
switch
CompositeFilter selectedFilter =
(CompositeFilter) cmbFilters.getSelectedItem();
@@ -1384,4 +1392,11 @@
return rv;
}
}
+
+ @Override
+ public void handleEvent(ColumnNameChangedEvent e) {
+
+ handleAttributesChanged();
+ logger.warn("A column name has been updated. The filter may not
be applied on some of the added widgets");
+ }
}
Modified:
core3/impl/trunk/filter-impl/src/main/java/org/cytoscape/filter/internal/widgets/autocomplete/view/TextIndexComboBox.java
===================================================================
---
core3/impl/trunk/filter-impl/src/main/java/org/cytoscape/filter/internal/widgets/autocomplete/view/TextIndexComboBox.java
2012-04-12 21:09:32 UTC (rev 28810)
+++
core3/impl/trunk/filter-impl/src/main/java/org/cytoscape/filter/internal/widgets/autocomplete/view/TextIndexComboBox.java
2012-04-12 22:20:22 UTC (rev 28811)
@@ -99,7 +99,7 @@
init();
// Populate menu with first X items
-// doc.populatePullDownMenu("");
+ doc.populatePullDownMenu("");
}
/**
@@ -117,7 +117,9 @@
}
// Populate menu with first X items
-// doc.populatePullDownMenu("");
+ // This can be a potential performance hit depending on the
number of calls and networks.
+ // currently this runs in a separate thread when handling
current network changed event.
+ doc.populatePullDownMenu("");
}
/**
--
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.