15
15
import java .awt .event .ItemEvent ;
16
16
import java .awt .event .MouseAdapter ;
17
17
import java .awt .event .MouseEvent ;
18
+ import java .util .ArrayList ;
18
19
import java .util .Collection ;
19
20
import java .util .Collections ;
20
21
import java .util .HashMap ;
@@ -795,7 +796,16 @@ private EMStyleOptions createStyleOptions(EnrichmentMap map, EMViewControlPanel
795
796
if (map == null || viewPanel == null )
796
797
return null ;
797
798
798
- Set <AbstractDataSet > dataSets = viewPanel .getDataSetSelector ().getCheckedItems ();
799
+ Set <AbstractDataSet > checkedDataSets = viewPanel .getDataSetSelector ().getCheckedItems ();
800
+
801
+ // Need to maintain the correct order
802
+ List <AbstractDataSet > dataSetList = new ArrayList <>();
803
+ for (AbstractDataSet ds : map .getDataSetList ()) { // Need to maintain the same order that's in the EnrichmentMap object
804
+ if (checkedDataSets .contains (ds )) {
805
+ dataSetList .add (ds );
806
+ }
807
+ }
808
+
799
809
boolean publicationReady = viewPanel .getPublicationReadyCheck ().isSelected ();
800
810
boolean postAnalysis = map .hasSignatureDataSets ();
801
811
@@ -814,7 +824,7 @@ private EMStyleOptions createStyleOptions(EnrichmentMap map, EMViewControlPanel
814
824
boolean showLabels = viewPanel .getShowChartLabelsCheck ().isSelected ();
815
825
ChartOptions chartOptions = new ChartOptions (data , type , colorScheme , showLabels );
816
826
817
- return new EMStyleOptions (viewPanel .getNetworkView (), map , dataSets , chartOptions , postAnalysis , publicationReady );
827
+ return new EMStyleOptions (viewPanel .getNetworkView (), map , dataSetList , chartOptions , postAnalysis , publicationReady );
818
828
}
819
829
820
830
private AssociatedStyleOptions createAssociatedStyleOptions (EnrichmentMap map , AssociatedViewControlPanel viewPanel ) {
0 commit comments