use of org.baderlab.csplugins.enrichmentmap.view.control.io.ViewParams in project EnrichmentMapApp by BaderLab.
the class ControlPanelMediator method reset.
public void reset(ViewParams params) {
long netViewID = params.getNetworkViewID();
invokeOnEDT(() -> {
EMViewControlPanel viewPanel = getControlPanel().getViewControlPanel(netViewID);
if (viewPanel == null)
return;
EnrichmentMap map = emManager.getEnrichmentMap(viewPanel.getNetworkView().getModel().getSUID());
if (map == null)
return;
try {
// Update Filters
if (params.getPValue() != null && viewPanel.getPValueSliderPanel() != null)
viewPanel.getPValueSliderPanel().setValue(params.getPValue());
if (params.getQValue() != null && viewPanel.getQValueSliderPanel() != null)
viewPanel.getQValueSliderPanel().setValue(params.getQValue());
if (params.getSimilarityCoefficient() != null && viewPanel.getSimilaritySliderPanel() != null)
viewPanel.getSimilaritySliderPanel().setValue(params.getSimilarityCoefficient());
if (params.getNodeCutoffParam() == CutoffParam.P_VALUE)
viewPanel.getPValueRadio().doClick();
else if (params.getNodeCutoffParam() == CutoffParam.Q_VALUE)
viewPanel.getQValueRadio().doClick();
Set<String> filteredOutDataSetNames = params.getFilteredOutDataSets();
if (filteredOutDataSetNames != null && !filteredOutDataSetNames.isEmpty()) {
Set<AbstractDataSet> allDataSets = viewPanel.getAllDataSets();
Set<AbstractDataSet> filteredDataSets = allDataSets.stream().filter(ds -> !filteredOutDataSetNames.contains(ds.getName())).collect(Collectors.toSet());
viewPanel.getDataSetSelector().setCheckedItems(filteredDataSets);
}
// Update Style options
ChartOptions chartOptions = params.getChartOptions();
viewPanel.getChartDataCombo().setSelectedItem(chartOptions != null ? chartOptions.getData() : null);
viewPanel.getChartTypeCombo().setSelectedItem(chartOptions != null ? chartOptions.getType() : null);
viewPanel.getChartColorsCombo().setSelectedItem(chartOptions != null ? chartOptions.getColorScheme() : null);
viewPanel.getShowChartLabelsCheck().setSelected(chartOptions != null && chartOptions.isShowLabels());
viewPanel.getPublicationReadyCheck().setSelected(params.isPublicationReady());
viewPanel.updateChartDataCombo();
updateVisualStyle(map, viewPanel);
filterNodesAndEdges(viewPanel, map);
} finally {
updating = false;
}
});
}
use of org.baderlab.csplugins.enrichmentmap.view.control.io.ViewParams in project EnrichmentMapApp by BaderLab.
the class ControlPanelMediator method getAllViewParams.
public Map<Long, ViewParams> getAllViewParams() {
Map<Long, ViewParams> map = new HashMap<>();
getControlPanel().getAllControlPanels().forEach((suid, panel) -> {
CutoffParam cuttofParam = panel.getPValueRadio().isSelected() ? CutoffParam.P_VALUE : CutoffParam.Q_VALUE;
Double pVal = panel.getPValueSliderPanel() != null ? panel.getPValueSliderPanel().getValue() : null;
Double qVal = panel.getQValueSliderPanel() != null ? panel.getQValueSliderPanel().getValue() : null;
Double sCoeff = panel.getSimilaritySliderPanel() != null ? panel.getSimilaritySliderPanel().getValue() : null;
Set<AbstractDataSet> uncheckedDataSets = panel.getUncheckedDataSets();
Set<String> filteredDataSets = uncheckedDataSets.stream().map(AbstractDataSet::getName).collect(Collectors.toSet());
EMStyleOptions options = createStyleOptions(panel.getNetworkView());
boolean pubReady = panel.getPublicationReadyCheck().isSelected();
ViewParams params = new ViewParams(suid, cuttofParam, pVal, qVal, sCoeff, filteredDataSets, options.getChartOptions(), pubReady);
map.put(suid, params);
});
return map;
}
Aggregations