// processes here, while the heavy weights are handled by the drawer's thread.
final JSlider source = (JSlider) e.getSource();
final double nodeScoreCutoff = (((double) source.getValue()) / 1000);
final int clusterRow = selectedRow;
// Store current cluster content for comparison
final Cluster oldCluster = clusters.get(clusterRow);
if (futureLoader != null && !futureLoader.isDone()) {
drawer.stop();
futureLoader.cancel(false);
if (!oldCluster.equals(clusters.get(clusterRow)))
oldCluster.dispose();
}
final Runnable command = new Runnable() {
@Override
public void run() {
final List<Long> oldALCluster = oldCluster.getALCluster();
// Find the new cluster given the node score cutoff
final Cluster newCluster = alg.exploreCluster(oldCluster, nodeScoreCutoff, network, resultId);
// We only want to do the following work if the newly found cluster is actually different
// So we get the new cluster content
List<Long> newALCluster = newCluster.getALCluster();
// If the new cluster is too large to draw within a reasonable time
// and won't look understandable in the table cell, then we draw a place holder
drawPlaceHolder = newALCluster.size() > 300;
// And compare the old and new
if (!newALCluster.equals(oldALCluster)) { // TODO
// If the cluster has changed, then we conduct all non-rate-limiting steps:
// Update the cluster array
clusters.set(clusterRow, newCluster);
// Update the cluster details
clusterBrowserPanel.update(newCluster, clusterRow);
// Fire the enumeration action
nodeAttributesComboBox.setSelectedIndex(nodeAttributesComboBox.getSelectedIndex());
// There is a small difference between expanding and retracting the cluster size.
// When expanding, new nodes need random position and thus must go through the layout.
// When retracting, we simply use the layout that was generated and stored.
// This speeds up the drawing process greatly.
boolean layoutNecessary = newALCluster.size() > oldALCluster.size();
// Draw Graph and select the cluster in the view in a separate thread so that it can be
// interrupted by the slider movement
if (!newCluster.isDisposed()) {
drawer.drawGraph(newCluster, layoutNecessary, drawPlaceHolder);
oldCluster.dispose();
}
}
mcodeUtil.destroyUnusedNetworks(network, clusters);// TODO