use of org.baderlab.csplugins.enrichmentmap.view.util.SliderBarPanel in project EnrichmentMapApp by BaderLab.
the class ControlPanelMediator method addNetworkView.
@SuppressWarnings("unchecked")
private void addNetworkView(CyNetworkView netView) {
invokeOnEDT(() -> {
EnrichmentMap map = emManager.getEnrichmentMap(netView.getModel().getSUID());
// Is the new view an EnrichmentMap one?
if (map != null) {
EMViewControlPanel viewPanel = getControlPanel().addEnrichmentMapView(netView);
if (viewPanel != null) {
// Add listeners to the new panel's fields
viewPanel.getQValueRadio().addActionListener(evt -> {
viewPanel.updateFilterPanel();
if (!updating)
filterNodesAndEdges(viewPanel, map);
});
viewPanel.getPValueRadio().addActionListener(evt -> {
viewPanel.updateFilterPanel();
if (!updating)
filterNodesAndEdges(viewPanel, map);
});
SliderBarPanel pvSliderPanel = viewPanel.getPValueSliderPanel();
SliderBarPanel qvSliderPanel = viewPanel.getQValueSliderPanel();
SliderBarPanel sSliderPanel = viewPanel.getSimilaritySliderPanel();
if (pvSliderPanel != null)
pvSliderPanel.addChangeListener(evt -> {
if (!updating)
filterNodesAndEdges(viewPanel, map);
});
if (qvSliderPanel != null)
qvSliderPanel.addChangeListener(evt -> {
if (!updating)
filterNodesAndEdges(viewPanel, map);
});
if (sSliderPanel != null)
sSliderPanel.addChangeListener(evt -> {
if (!updating)
filterNodesAndEdges(viewPanel, map);
});
viewPanel.getDataSetSelector().addPropertyChangeListener("checkedData", evt -> {
if (!updating) {
viewPanel.updateChartDataCombo();
filterNodesAndEdges(viewPanel, map);
ChartData data = (ChartData) viewPanel.getChartDataCombo().getSelectedItem();
Set<EMDataSet> oldDataSets = filterDataSets((Collection<AbstractDataSet>) evt.getOldValue());
Set<EMDataSet> newDataSets = filterDataSets((Collection<AbstractDataSet>) evt.getNewValue());
int oldSize = oldDataSets.size();
int newSize = newDataSets.size();
boolean updateStyle = data != null && data != ChartData.NONE && oldSize != newSize;
updateStyle = updateStyle || oldSize == 0 && newSize > 0;
updateStyle = updateStyle || oldSize > 0 && newSize == 0;
updateStyle = updateStyle || oldSize == 1 && newSize > 1;
updateStyle = updateStyle || oldSize > 1 && newSize == 1;
if (updateStyle)
updateVisualStyle(map, viewPanel);
else
netView.updateView();
}
});
viewPanel.getDataSetSelector().getAddButton().addActionListener(evt -> {
postAnalysisPanelMediatorProvider.get().showDialog(viewPanel, netView);
});
viewPanel.getDataSetSelector().getRemoveButton().addActionListener(evt -> {
removeSignatureDataSets(map, viewPanel);
});
viewPanel.getChartDataCombo().addItemListener(evt -> {
if (!updating && evt.getStateChange() == ItemEvent.SELECTED) {
updating = true;
try {
viewPanel.updateChartCombos();
} finally {
updating = false;
}
updateVisualStyle(map, viewPanel, true);
}
});
viewPanel.getChartTypeCombo().addItemListener(evt -> {
if (!updating && evt.getStateChange() == ItemEvent.SELECTED) {
updating = true;
try {
viewPanel.updateChartColorsCombo();
viewPanel.updateChartLabelsCheck();
} finally {
updating = false;
}
updateVisualStyle(map, viewPanel, true);
}
});
viewPanel.getChartColorsCombo().addItemListener(evt -> {
if (!updating && evt.getStateChange() == ItemEvent.SELECTED)
updateVisualStyle(map, viewPanel, true);
});
viewPanel.getShowChartLabelsCheck().addActionListener(evt -> {
if (!updating)
updateVisualStyle(map, viewPanel, true);
});
viewPanel.getPublicationReadyCheck().addActionListener(evt -> {
if (!updating)
updateVisualStyle(map, viewPanel);
});
viewPanel.getResetStyleButton().addActionListener(evt -> {
updateVisualStyle(map, viewPanel);
});
viewPanel.getSetEdgeWidthButton().addActionListener(evt -> {
showEdgeWidthDialog();
});
viewPanel.updateChartDataCombo();
}
}
});
}
Aggregations